Class: Ua::Util::AppHelper
- Inherits:
-
Object
- Object
- Ua::Util::AppHelper
- Defined in:
- lib/ua/util.rb
Instance Method Summary collapse
- #define_command(name, id, *names, &bl) ⇒ Object
-
#initialize(app = Ua::Application.top_app) ⇒ AppHelper
constructor
A new instance of AppHelper.
- #pop ⇒ Object
- #push ⇒ Object
Constructor Details
#initialize(app = Ua::Application.top_app) ⇒ AppHelper
Returns a new instance of AppHelper.
51 52 53 |
# File 'lib/ua/util.rb', line 51 def initialize(app = Ua::Application.top_app) @app = app end |
Instance Method Details
#define_command(name, id, *names, &bl) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/ua/util.rb', line 57 def define_command(name, id, *names, &bl) bl ||= lambda{|a| a} uaobject = Helper.new @app.get id (class << self; self; end).send :define_method, name do |*args| uaobject[*names] = args bl.call(context(uaobject, :app)) end end |
#pop ⇒ Object
65 66 67 |
# File 'lib/ua/util.rb', line 65 def pop Ua::Application.pop_app if Ua::Application.top_app == @app end |
#push ⇒ Object
54 55 56 |
# File 'lib/ua/util.rb', line 54 def push Ua::Application.push_app @app end |