Sha256: 2d09afdc643e38be0e9ab539b19f942ad667168077e96fcc004dea170dc3dc2a

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

require "forwardable"
require "mobile_enhancements"
require "mobile_enhancements/request_helper"

module MobileEnhancements
  module HelperDelegation
    def self.included(base)
      base.extend Forwardable
      base.def_delegators :mobile_enhancement_helpers, *RequestHelper.delegated_methods
      # make the methods available as view helpers if available
      if base.respond_to?(:helper_method)
        base.helper_method *RequestHelper.delegated_methods
      end
    end

    private
    def mobile_enhancement_helpers
      @mobile_enhancement_helpers ||= RequestHelper.new(request, MobileEnhancements.configuration)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobile-enhancements-0.0.2 lib/mobile_enhancements/helper_delegation.rb
mobile-enhancements-0.0.1 lib/mobile_enhancements/helper_delegation.rb