Class: Hubert::DSL::MethodDefiner
- Inherits:
-
Object
- Object
- Hubert::DSL::MethodDefiner
- Defined in:
- lib/hubert/dsl.rb
Instance Method Summary collapse
- #define(method, path, options) ⇒ Object
-
#initialize(klass) ⇒ MethodDefiner
constructor
A new instance of MethodDefiner.
Constructor Details
#initialize(klass) ⇒ MethodDefiner
Returns a new instance of MethodDefiner.
5 6 7 |
# File 'lib/hubert/dsl.rb', line 5 def initialize(klass) @klass = klass end |
Instance Method Details
#define(method, path, options) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/hubert/dsl.rb', line 9 def define(method, path, ) ensure_alias!(, method) @klass.class_eval " def \#{options[:as]}_\#{method}(ctx = {}) # def get_items_path(ctx = {})\n self.class._hubert_builder.\#{method}('\#{path}', ctx) # self.class._hubert_builder.url('some/:interesting/path:id', ctx)\n end # end\n RUBY\nend\n", __FILE__, __LINE__ + 1 |