Class: Codeland::Starter::Configuration
- Inherits:
-
Object
- Object
- Codeland::Starter::Configuration
- Defined in:
- lib/codeland/starter/configuration.rb
Constant Summary collapse
- DEFAULT_FILENAME =
'codeland-starter.yml'
Instance Attribute Summary collapse
-
#yaml ⇒ Object
readonly
Returns the value of attribute yaml.
Class Method Summary collapse
Instance Method Summary collapse
- #default_yaml_file ⇒ Object
-
#initialize(yaml_file = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #integrations ⇒ Object
Constructor Details
#initialize(yaml_file = nil) ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/codeland/starter/configuration.rb', line 11 def initialize(yaml_file = nil) @yaml = if yaml_file && File.exists?(yaml_file) YAML.load_file(File.open(yaml_file)) elsif File.exists?(default_yaml_file) YAML.load_file(File.open(default_yaml_file)) else = 'Please install with `codeland-starter install`' raise MissingYAML, end end |
Instance Attribute Details
#yaml ⇒ Object (readonly)
Returns the value of attribute yaml.
7 8 9 |
# File 'lib/codeland/starter/configuration.rb', line 7 def yaml @yaml end |
Class Method Details
Instance Method Details
#default_yaml_file ⇒ Object
22 23 24 |
# File 'lib/codeland/starter/configuration.rb', line 22 def default_yaml_file File.join(Dir.home, DEFAULT_FILENAME) end |
#integrations ⇒ Object
26 27 28 |
# File 'lib/codeland/starter/configuration.rb', line 26 def integrations yaml['integrations'] end |