Class: Tasking::Options
- Inherits:
-
Object
- Object
- Tasking::Options
- Defined in:
- lib/tasking/options.rb
Instance Attribute Summary collapse
-
#options_hash ⇒ Object
readonly
Returns the value of attribute options_hash.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](key) ⇒ Object
-
#initialize(hash) ⇒ Options
constructor
A new instance of Options.
- #materialized_hash ⇒ Object
- #merge(other) ⇒ Object
- #merge!(other) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Options
Returns a new instance of Options.
11 12 13 |
# File 'lib/tasking/options.rb', line 11 def initialize(hash) @options_hash = hash end |
Instance Attribute Details
#options_hash ⇒ Object (readonly)
Returns the value of attribute options_hash.
3 4 5 |
# File 'lib/tasking/options.rb', line 3 def @options_hash end |
Class Method Details
.build(options) ⇒ Object
5 6 7 8 9 |
# File 'lib/tasking/options.rb', line 5 def self.build( ) return if .is_a?( self ) new( ) end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 |
# File 'lib/tasking/options.rb', line 28 def ==(other) == ( other ) end |
#[](key) ⇒ Object
15 16 17 |
# File 'lib/tasking/options.rb', line 15 def [](key) resolve_value( [key] ) end |
#materialized_hash ⇒ Object
32 33 34 35 36 |
# File 'lib/tasking/options.rb', line 32 def materialized_hash .map do |key, value| [ key, resolve_value( value ) ] end.to_h end |
#merge(other) ⇒ Object
19 20 21 |
# File 'lib/tasking/options.rb', line 19 def merge(other) self.class.new( .merge( ( other ) ) ) end |
#merge!(other) ⇒ Object
23 24 25 26 |
# File 'lib/tasking/options.rb', line 23 def merge!(other) .merge!( ( other ) ) self end |