Class: Phenotype::HeaderStrategy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header: 'Sue') ⇒ HeaderStrategy

Returns a new instance of HeaderStrategy.



7
8
9
# File 'lib/phenotype/strategies/header_strategy.rb', line 7

def initialize(header: 'Sue')
  @header = header
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



5
6
7
# File 'lib/phenotype/strategies/header_strategy.rb', line 5

def header
  @header
end

Instance Method Details

#version(env) ⇒ Object



11
12
13
# File 'lib/phenotype/strategies/header_strategy.rb', line 11

def version(env)
  env["HTTP_#{header.upcase}"] || NullStrategy.new
end