Method: Pakman::Ctx#method_missing

Defined in:
lib/pakman/cli/ctx.rb

#method_missing(mn, *args, &blk) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pakman/cli/ctx.rb', line 16

def method_missing( mn, *args, &blk )
  ## only allow read-only access (no arguments)
  if args.length > 0    # || mn[-1].chr == "="
    return super # super( mn, *args, &blk )
  end

  key = mn.to_s

  if @hash.has_key?( key )
    puts "calling ctx.#{key}"
    value = @hash[ key ]
    puts "  returning #{value.class.name}:"
    pp value
    value
  else
    puts "*** warning: ctx.#{key} missing"
    super
  end
end