class BranchIOCLI::Configuration::OptionWrapper
Proxy class for use with Command.new.
Attributes
add_defaults[R]
hash[R]
options[R]
Public Class Methods
new(hash, options, add_defaults = true)
click to toggle source
# File lib/branch_io_cli/configuration/option_wrapper.rb, line 9 def initialize(hash, options, add_defaults = true) hash ||= {} @hash = hash @options = options @add_defaults = add_defaults build_option_hash end
Public Instance Methods
build_option_hash()
click to toggle source
# File lib/branch_io_cli/configuration/option_wrapper.rb, line 31 def build_option_hash @option_hash = options.inject({}) { |hash, o| hash.merge o.name => o } end
method_missing(method_sym, *arguments, &block)
click to toggle source
Calls superclass method
# File lib/branch_io_cli/configuration/option_wrapper.rb, line 19 def method_missing(method_sym, *arguments, &block) option = @option_hash[method_sym] return super unless option value = hash[method_sym] return value unless add_defaults && value.nil? default_value = option.env_value default_value = option.default_value if default_value.nil? default_value end