class SanaController::Params

named access to request headers

Public Class Methods

new(request, mapping = {}) click to toggle source

constructor @param [OpenStruct] request request @param [Hash<Symbol, Integer>] mapping request argument mappings @example mapping

params = SanaController::Params.new(request, {shell_name: 0, halted: 6, halted_ghost_name: 7}) # mapping for Reference0, 6 and 7
# File lib/sana_controller.rb, line 101
def initialize(request, mapping = {})
  @request = request
  @mapping = mapping
end

Public Instance Methods

method_missing(method) click to toggle source

named access to the header @example named access

params.shell_name == params.Reference0

@param [Symbol] method param name @return [String] header value

# File lib/sana_controller.rb, line 111
def method_missing(method)
  @request[method] || @request["Reference#{@mapping[method]}".to_sym]
end