Class: FriendlyRoutes::Params::HashParams
- Defined in:
- lib/friendly_routes/params/hash_params.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Attributes inherited from Base
Instance Method Summary collapse
- #constraints ⇒ Object
-
#initialize(name, hash, optional: true) ⇒ HashParams
constructor
A new instance of HashParams.
- #parse(value) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name, hash, optional: true) ⇒ HashParams
Returns a new instance of HashParams.
8 9 10 11 12 |
# File 'lib/friendly_routes/params/hash_params.rb', line 8 def initialize(name, hash, optional: true) super(:collection, name, optional) @hash = hash check_params end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
6 7 8 |
# File 'lib/friendly_routes/params/hash_params.rb', line 6 def hash @hash end |
Instance Method Details
#constraints ⇒ Object
14 15 16 |
# File 'lib/friendly_routes/params/hash_params.rb', line 14 def constraints Regexp.new @hash.keys.join('|') end |
#parse(value) ⇒ Object
18 19 20 |
# File 'lib/friendly_routes/params/hash_params.rb', line 18 def parse(value) @hash[value] end |