lib/gara/delegator.rb in gara-0.1.5 vs lib/gara/delegator.rb in gara-0.1.6
- old
+ new
@@ -1,22 +1,13 @@
module Gara
class Delegator
attr_accessor :emitter
- def self.define_delegate(method_name, on: nil, to: nil)
- on.module_eval <<-RUBY
- def #{method_name}(*args)
- #{to || "@gara_delegate"}.#{method_name}(*args) { yield if block_given? }
- end
- RUBY
- end
-
-
def initialize(view_context, emitter)
@emitter = emitter
view_context.instance_variable_set(:@gara_delegate, emitter)
- view_context.extend(emitter.registered_methods)
+ emitter.add_methods_to(view_context)
yield if block_given?
end
def render
@emitter.emit
\ No newline at end of file