class Tasking::Options
Attributes
options_hash[R]
Public Class Methods
build( options )
click to toggle source
# File lib/tasking/options.rb, line 5 def self.build( options ) return options if options.is_a?( self ) new( options ) end
new(hash)
click to toggle source
# File lib/tasking/options.rb, line 11 def initialize(hash) @options_hash = hash end
Public Instance Methods
==(other)
click to toggle source
# File lib/tasking/options.rb, line 28 def ==(other) options_hash == extract_options_hash( other ) end
[](key)
click to toggle source
# File lib/tasking/options.rb, line 15 def [](key) resolve_value( options_hash[key] ) end
materialized_hash()
click to toggle source
# File lib/tasking/options.rb, line 32 def materialized_hash options_hash.map do |key, value| [ key, resolve_value( value ) ] end.to_h end
merge(other)
click to toggle source
# File lib/tasking/options.rb, line 19 def merge(other) self.class.new( options_hash.merge( extract_options_hash( other ) ) ) end
merge!(other)
click to toggle source
# File lib/tasking/options.rb, line 23 def merge!(other) options_hash.merge!( extract_options_hash( other ) ) self end
Private Instance Methods
extract_options_hash(other)
click to toggle source
# File lib/tasking/options.rb, line 44 def extract_options_hash(other) other.is_a?( self.class ) ? other.options_hash : other end
resolve_value( value )
click to toggle source
# File lib/tasking/options.rb, line 40 def resolve_value( value ) value.respond_to?( :call ) ? value.call( self ) : value end