Sha256: d66cd1acb0fbaa9196682ece16dcbf76c89f71567f132584613d2f5c31e9fea3

Contents?: true

Size: 615 Bytes

Versions: 6

Compression:

Stored size: 615 Bytes

Contents

module CobotClient
  module XdmHelper
    def self.included(base)
      if base.ancestors.include?(ActionController::Base)
        base.class_eval do
          before_filter :capture_xdm_params
          helper_method :xdm_params
        end
      end
    end

    def xdm_params
      session.inject({}) do |hash, element|
        if element.first.match(/xdm\_/)
          hash[element.first] = element.last
        end
        hash
      end
    end

    def capture_xdm_params
      params.each do |key, value|
        if key.match(/xdm\_/)
          session[key] = value
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cobot_client-0.6.0 app/helpers/cobot_client/xdm_helper.rb
cobot_client-0.5.0 app/helpers/cobot_client/xdm_helper.rb
cobot_client-0.4.0 app/helpers/cobot_client/xdm_helper.rb
cobot_client-0.3.0 app/helpers/cobot_client/xdm_helper.rb
cobot_client-0.2.0 app/helpers/cobot_client/xdm_helper.rb
cobot_client-0.1.0 app/helpers/cobot_client/xdm_helper.rb