Sha256: d319f124a34fc107f8a8731c9c8a2e316bb56008afc43eb2dc16e5673b0fc0c8

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

require "forwardable"
require "mobile_enhancements"
require "mobile_enhancements/request_helper"
require "mobile_enhancements/url_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
      # include the UrlHelper
      base.send(:include, UrlHelper)
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mobile-enhancements-0.0.5 lib/mobile_enhancements/helper_delegation.rb
mobile-enhancements-0.0.4 lib/mobile_enhancements/helper_delegation.rb
mobile-enhancements-0.0.3 lib/mobile_enhancements/helper_delegation.rb