class Pakman::Ctx
Public Class Methods
new( hash )
click to toggle source
# File lib/pakman/cli/ctx.rb, line 7 def initialize( hash ) @hash = hash end
Public Instance Methods
ctx()
click to toggle source
# File lib/pakman/cli/ctx.rb, line 11 def ctx ### todo: check if method_missing works with binding in erb??? binding end
method_missing( mn, *args, &blk )
click to toggle source
Calls superclass method
# 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