Class: EmbeddedJs::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/embedded_js/config.rb

Constant Summary collapse

DEFAULT_CONFIG_PATH =
'./.embeddedjs'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package_manager: :npm, gems: []) ⇒ Config

Returns a new instance of Config.



17
18
19
20
# File 'lib/embedded_js/config.rb', line 17

def initialize(package_manager: :npm, gems: [])
  @gems = gems
  @package_manager = package_manager.to_sym
end

Instance Attribute Details

#gemsObject

Returns the value of attribute gems.



15
16
17
# File 'lib/embedded_js/config.rb', line 15

def gems
  @gems
end

#package_managerObject

Returns the value of attribute package_manager.



15
16
17
# File 'lib/embedded_js/config.rb', line 15

def package_manager
  @package_manager
end

Class Method Details

.load(config_path: DEFAULT_CONFIG_PATH) ⇒ Object



10
11
12
# File 'lib/embedded_js/config.rb', line 10

def load(config_path: DEFAULT_CONFIG_PATH)
  new(**JSON.parse(File.read(config_path), symbolize_names: true))
end