Class: Theine::ConfigReader
- Inherits:
-
Object
- Object
- Theine::ConfigReader
- Defined in:
- lib/theine/config.rb
Instance Attribute Summary collapse
-
#base_port ⇒ Object
Returns the value of attribute base_port.
-
#max_port ⇒ Object
Returns the value of attribute max_port.
-
#min_free_workers ⇒ Object
Returns the value of attribute min_free_workers.
-
#rails_root ⇒ Object
readonly
Returns the value of attribute rails_root.
-
#silent ⇒ Object
Returns the value of attribute silent.
-
#spawn_parallel ⇒ Object
Returns the value of attribute spawn_parallel.
Instance Method Summary collapse
-
#initialize(rails_root) ⇒ ConfigReader
constructor
A new instance of ConfigReader.
- #load_config(path) ⇒ Object
Constructor Details
#initialize(rails_root) ⇒ ConfigReader
Returns a new instance of ConfigReader.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/theine/config.rb', line 15 def initialize(rails_root) @rails_root = rails_root @base_port = 11000 @max_port = 11100 @min_free_workers = 2 @spawn_parallel = true @silent = false load_config(File.("~/.theine")) load_config("#{rails_root}/.theine") end |
Instance Attribute Details
#base_port ⇒ Object
Returns the value of attribute base_port.
14 15 16 |
# File 'lib/theine/config.rb', line 14 def base_port @base_port end |
#max_port ⇒ Object
Returns the value of attribute max_port.
14 15 16 |
# File 'lib/theine/config.rb', line 14 def max_port @max_port end |
#min_free_workers ⇒ Object
Returns the value of attribute min_free_workers.
14 15 16 |
# File 'lib/theine/config.rb', line 14 def min_free_workers @min_free_workers end |
#rails_root ⇒ Object (readonly)
Returns the value of attribute rails_root.
13 14 15 |
# File 'lib/theine/config.rb', line 13 def rails_root @rails_root end |
#silent ⇒ Object
Returns the value of attribute silent.
14 15 16 |
# File 'lib/theine/config.rb', line 14 def silent @silent end |
#spawn_parallel ⇒ Object
Returns the value of attribute spawn_parallel.
14 15 16 |
# File 'lib/theine/config.rb', line 14 def spawn_parallel @spawn_parallel end |
Instance Method Details
#load_config(path) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/theine/config.rb', line 26 def load_config(path) if File.exist?(path) config = YAML.load(File.read(path)) config.each_pair do |k, v| setter = :"#{k}=" send(setter, v) if respond_to?(setter) end end end |