Sha256: e8bac66d8f5885873cde353dccbda9525a71f1467243f99b7e970173d3154efc
Contents?: true
Size: 834 Bytes
Versions: 1
Compression:
Stored size: 834 Bytes
Contents
# frozen_string_literal: true # On the fly delegation from the decorator to the decorated object and the helpers. module ActiveDecorator module Helpers def method_missing(method, *args, &block) super rescue NoMethodError, NameError => e # the error is not mine, so just releases it as is. raise e if e.name != method begin (view_context = ActiveDecorator::ViewContext.current).send method, *args, &block rescue NoMethodError => e raise e if e.name != method raise NoMethodError.new("undefined method `#{method}' for either #{self} or #{view_context}", method) rescue NameError => e raise e if e.name != method raise NameError.new("undefined local variable `#{method}' for either #{self} or #{view_context}", method) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_decorator-1.1.0 | lib/active_decorator/helpers.rb |