Class: Phenotype::ParamStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/strategies/param_strategy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#paramObject (readonly)

Returns the value of attribute param.



4
5
6
# File 'lib/strategies/param_strategy.rb', line 4

def param
  @param
end

#requestObject (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

#versionObject



14
15
16
# File 'lib/strategies/param_strategy.rb', line 14

def version
  @version ||= request.params[param]
end