class ERBReflective

Override some ERB behaviour to make it reflect methods supported by an object that is passed to it

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/erb_reflective.rb, line 15
def method_missing(meth, *args, &block)
  super unless respond_to_missing? meth
  @other_object&.send(meth, *args, &block)
end
respond_to_missing?(meth) click to toggle source
# File lib/erb_reflective.rb, line 20
def respond_to_missing?(meth)
  @other_object&.respond_to? meth
end
result(other_object) click to toggle source

Simply store the object reference passed in then call the superclass behaviour with our binding instead

Calls superclass method
# File lib/erb_reflective.rb, line 10
def result(other_object)
  @other_object = other_object
  super(binding)
end