Class: IceCube::HashBuilder
- Inherits:
-
Object
- Object
- IceCube::HashBuilder
- Defined in:
- lib/ice_cube/builders/hash_builder.rb
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
-
#initialize(rule = nil) ⇒ HashBuilder
constructor
A new instance of HashBuilder.
- #to_hash ⇒ Object
- #validations ⇒ Object
- #validations_array(type) ⇒ Object
Constructor Details
#initialize(rule = nil) ⇒ HashBuilder
Returns a new instance of HashBuilder.
3 4 5 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 3 def initialize(rule = nil) @hash = {validations: {}, rule_type: rule.class.name} end |
Instance Method Details
#[]=(key, value) ⇒ Object
11 12 13 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 11 def []=(key, value) @hash[key] = value end |
#to_hash ⇒ Object
19 20 21 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 19 def to_hash @hash end |
#validations ⇒ Object
7 8 9 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 7 def validations @hash[:validations] end |
#validations_array(type) ⇒ Object
15 16 17 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 15 def validations_array(type) validations[type] ||= [] end |