Sha256: b889445781df0e64c2cdd10ad6b558ae35bcf46b305d47dbdfedf98028d43c86
Contents?: true
Size: 937 Bytes
Versions: 1
Compression:
Stored size: 937 Bytes
Contents
module Draper # Provides access to helper methods - both Rails built-in helpers, and those # defined in your application. class HelperProxy # @overload initialize(view_context) def initialize(view_context = nil) view_context ||= current_view_context # backwards compatibility @view_context = view_context end # Sends helper methods to the view context. def method_missing(method, *args, &block) self.class.define_proxy method send(method, *args, &block) end protected attr_reader :view_context private def self.define_proxy(name) define_method name do |*args, &block| view_context.send(name, *args, &block) end end def current_view_context ActiveSupport::Deprecation.warn("wrong number of arguments (0 for 1) passed to Draper::HelperProxy.new", caller[1..-1]) Draper::ViewContext.current.view_context end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
draper-1.1.0 | lib/draper/helper_proxy.rb |