Sha256: 3f11b846ea9a9d7f48de3af1b04cfa4873dfbc29e0207806d9af8b5c7991effb

Contents?: true

Size: 889 Bytes

Versions: 6

Compression:

Stored size: 889 Bytes

Contents

module Draper
  module ViewHelpers
    extend ActiveSupport::Concern

    module ClassMethods

      # Access the helpers proxy to call built-in and user-defined
      # Rails helpers from a class context.
      #
      # @return [HelperProxy] the helpers proxy
      def helpers
        @helpers ||= Draper::HelperProxy.new
      end
      alias_method :h, :helpers

    end

    # Access the helpers proxy to call built-in and user-defined
    # Rails helpers. Aliased to `h` for convenience.
    #
    # @return [HelperProxy] the helpers proxy
    def helpers
      self.class.helpers
    end
    alias_method :h, :helpers

    # Localize is something that's used quite often. Even though
    # it's available through helpers, that's annoying. Aliased
    # to `l` for convenience.
    def localize(*args)
      helpers.localize(*args)
    end
    alias_method :l, :localize

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
draper-1.0.0.beta6 lib/draper/view_helpers.rb
draper-1.0.0.beta5 lib/draper/view_helpers.rb
draper-1.0.0.beta4 lib/draper/view_helpers.rb
draper-1.0.0.beta3 lib/draper/view_helpers.rb
draper-1.0.0.beta2 lib/draper/view_helpers.rb
draper-1.0.0.beta1 lib/draper/view_helpers.rb