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

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

Instance Method Summary collapse

Constructor Details

#initialize(evaluation) ⇒ FlagProxy

: (Evaluation evaluation) -> void



49
50
51
# File 'lib/cli/kit/args/evaluation.rb', line 49

def initialize(evaluation)
  @evaluation = evaluation
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym) ⇒ Object

: (Symbol sym) -> bool



34
35
36
37
38
39
40
41
# File 'lib/cli/kit/args/evaluation.rb', line 34

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

: (Symbol sym, ?bool include_private) -> bool

Returns:

  • (Boolean)


44
45
46
# File 'lib/cli/kit/args/evaluation.rb', line 44

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