Class: Hubert::DSL::MethodDefiner

Inherits:
Object
  • Object
show all
Defined in:
lib/hubert/dsl.rb

Instance Method Summary collapse

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, options)
  ensure_alias!(options, 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