class Poise::Helpers::OptionCollector::OptionEvalContext
Instance context used to eval option blocks. @api private
Attributes
_options[R]
Public Class Methods
new(parent, forced_keys)
click to toggle source
# File lib/poise/helpers/option_collector.rb, line 47 def initialize(parent, forced_keys) @parent = parent @forced_keys = forced_keys @_options = {} end
Public Instance Methods
method_missing(method_sym, *args, &block)
click to toggle source
# File lib/poise/helpers/option_collector.rb, line 53 def method_missing(method_sym, *args, &block) # Deal with forced keys. if @forced_keys.include?(method_sym) @_options[method_sym] = args.first || block if !args.empty? || block return @_options[method_sym] end # Try the resource context. @parent.send(method_sym, *args, &block) rescue NameError # Even though method= in the block will set a variable instead of # calling method_missing, still try to cope in case of self.method=. method_sym = method_sym.to_s.chomp('=').to_sym if !args.empty? || block @_options[method_sym] = args.first || block elsif !@_options.include?(method_sym) # We haven't seen this name before, re-raise the NameError. raise end @_options[method_sym] end