Class: Contraption::Options
- Inherits:
-
Object
- Object
- Contraption::Options
- Defined in:
- lib/contraption/options.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(args) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(args) ⇒ Options
Returns a new instance of Options.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/contraption/options.rb', line 15 def initialize args @values = { source: DEFAULT_SOURCE, destination: DEFAULT_DESTINATION, s3_access_key_id: nil, s3_secret_access_key: nil, s3_target_bucket: nil } @values.merge!(YAML.load_file(DEFAULT_CONFIG_FILE)) if DEFAULT_CONFIG_FILE.file? @values.each_pair {|k, v| @values[k] = Location.new(v) if %i[source destination].include? k} parse(args) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a, &b) ⇒ Object (private)
29 30 31 |
# File 'lib/contraption/options.rb', line 29 def method_missing m, *a, &b values.fetch(m) { super } end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
13 14 15 |
# File 'lib/contraption/options.rb', line 13 def values @values end |