module Nydp::AutoWrap

Public Instance Methods

_nydp_get(key ;) click to toggle source
# File lib/nydp/helper.rb, line 24
def _nydp_get                 key ; _nydp_safe_send(key.to_s.as_method_name) ; end
_nydp_ok?(method ;) click to toggle source

include this and be sure to either override _nydp_ok? or _nydp_whitelist _nydp_whitelist should return a list of accessor (zero-arg) methods which are safe for nydp to call _nydp_procify should return a list of methods that can be exposed to script code.

class Blub

_nydp_procs << :blubme
def blubme where, when
  puts "blubme #{where}, #{when}"
end

end

in nydp, if blub is an instance of Blub:

(blub.blubme “here” “now”)

prints

blubme here, now

# File lib/nydp/helper.rb, line 22
def _nydp_ok?              method ; _nydp_whitelist.include? method          ; end
_nydp_procify?(method ;) click to toggle source
# File lib/nydp/helper.rb, line 23
def _nydp_procify?         method ; _nydp_procs.include? method              ; end
_nydp_safe_send(meth, *args) click to toggle source
# File lib/nydp/helper.rb, line 25
def _nydp_safe_send meth, *args
  return send meth, *args if _nydp_ok?(meth)
  return method(meth)     if _nydp_procify?(meth)
end