Class: Ive::Configuration
- Inherits:
-
Object
- Object
- Ive::Configuration
- Defined in:
- lib/ive/configuration.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #config_path ⇒ Object
- #exists? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #read_config ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ive/configuration.rb', line 9 def initialize if self.exists? self.read_config unless self.valid? puts "-- Invalid .ive config file." end else puts "-- No .ive config file found." end end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/ive/configuration.rb', line 7 def configuration @configuration end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/ive/configuration.rb', line 6 def target @target end |
Instance Method Details
#config_path ⇒ Object
34 35 36 |
# File 'lib/ive/configuration.rb', line 34 def config_path @config_path ||= File.join(Ive.path,'.ive') end |
#exists? ⇒ Boolean
30 31 32 |
# File 'lib/ive/configuration.rb', line 30 def exists? File.exists?(self.config_path) end |
#read_config ⇒ Object
20 21 22 23 24 |
# File 'lib/ive/configuration.rb', line 20 def read_config params = YAML::load File.open(self.config_path) @target = params["target"] @configuration = params["configuration"] end |
#valid? ⇒ Boolean
26 27 28 |
# File 'lib/ive/configuration.rb', line 26 def valid? @target && @configuration end |