Class: Phenotype::ParamStrategy
- Inherits:
-
Object
- Object
- Phenotype::ParamStrategy
- Defined in:
- lib/strategies/param_strategy.rb
Instance Attribute Summary collapse
-
#param ⇒ Object
readonly
Returns the value of attribute param.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #get_version(env) ⇒ Object
-
#initialize(param = 'v') ⇒ ParamStrategy
constructor
A new instance of ParamStrategy.
- #version ⇒ Object
Constructor Details
#initialize(param = 'v') ⇒ ParamStrategy
Returns a new instance of ParamStrategy.
5 6 7 |
# File 'lib/strategies/param_strategy.rb', line 5 def initialize(param = 'v') @param = param end |
Instance Attribute Details
#param ⇒ Object (readonly)
Returns the value of attribute param.
4 5 6 |
# File 'lib/strategies/param_strategy.rb', line 4 def param @param end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
4 5 6 |
# File 'lib/strategies/param_strategy.rb', line 4 def request @request end |
Instance Method Details
#get_version(env) ⇒ Object
9 10 11 12 |
# File 'lib/strategies/param_strategy.rb', line 9 def get_version(env) @request = Rack::Request.new(env) version end |
#version ⇒ Object
14 15 16 |
# File 'lib/strategies/param_strategy.rb', line 14 def version @version ||= request.params[param] end |