Class: CLI::Kit::Args::Evaluation::FlagProxy

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/cli/kit/args/evaluation.rb

Instance Method Summary collapse

Methods included from T::Sig

sig

Constructor Details

#initialize(evaluation) ⇒ FlagProxy

Returns a new instance of FlagProxy.



56
57
58
# File 'lib/cli/kit/args/evaluation.rb', line 56

def initialize(evaluation)
  @evaluation = evaluation
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/cli/kit/args/evaluation.rb', line 41

def method_missing(sym)
  flag = @evaluation.defn.lookup_flag(sym)
  unless flag
    raise NoMethodError, "undefined flag `#{sym}' for #{self}"
  end

  @evaluation.send(:lookup_flag, flag)
end

Instance Method Details

#respond_to_missing?(sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/cli/kit/args/evaluation.rb', line 51

def respond_to_missing?(sym, include_private = false)
  !!@evaluation.defn.lookup_flag(sym)
end