Module: Rack::TradeTracker::Parameters::Delimited

Defined in:
lib/rack/trade_tracker/parameters/delimited.rb

Constant Summary collapse

DELIMITER =
'_'.freeze
REDIRECT_PARAM =
'r'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rack/trade_tracker/parameters/delimited.rb', line 11

def self.extended(base)
  values = base.instance_eval do
    param = params[TT_PARAM]
    param.present? ? param.split(DELIMITER) : []
  end

  PERMITTED_PARAMS.each_with_index do |param, index|
    define_method param.underscore do
      values[index] || MISSING_PARAM_VALUE
    end
  end
end

Instance Method Details

#redirect_urlObject



25
26
27
# File 'lib/rack/trade_tracker/parameters/delimited.rb', line 25

def redirect_url
  params[REDIRECT_PARAM] || MISSING_PARAM_VALUE
end