Class: IknowParams::Parser::HashParser

Inherits:
Object
  • Object
show all
Includes:
IknowParams::Parser
Defined in:
lib/iknow_params/parser/hash_parser.rb

Overview

Simple wrapper to use IknowParams::Parser to extract and verify content from an arbitrary hash

Constant Summary

Constants included from IknowParams::Parser

BLANK, PARAM_REQUIRED

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from IknowParams::Parser

#parse_array_param, parse_hash, #parse_param, parse_value, parse_values, register_serializer, #remove_blanks

Constructor Details

#initialize(view_hash) ⇒ HashParser

Returns a new instance of HashParser.



12
13
14
# File 'lib/iknow_params/parser/hash_parser.rb', line 12

def initialize(view_hash)
  @params = ActiveSupport::HashWithIndifferentAccess.new(view_hash)
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



10
11
12
# File 'lib/iknow_params/parser/hash_parser.rb', line 10

def params
  @params
end

Instance Method Details

#parse(&block) ⇒ Object



16
17
18
# File 'lib/iknow_params/parser/hash_parser.rb', line 16

def parse(&block)
  instance_exec(&block)
end