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.
5 6 7 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 5 def initialize(rule = nil) @hash = { :validations => {}, :rule_type => rule.class.name } end |
Instance Method Details
#[]=(key, value) ⇒ Object
13 14 15 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 13 def []=(key, value) @hash[key] = value end |
#to_hash ⇒ Object
21 22 23 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 21 def to_hash @hash end |
#validations ⇒ Object
9 10 11 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 9 def validations @hash[:validations] end |
#validations_array(type) ⇒ Object
17 18 19 |
# File 'lib/ice_cube/builders/hash_builder.rb', line 17 def validations_array(type) validations[type] ||= [] end |