Class: IceCube::HashBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ice_cube/builders/hash_builder.rb

Instance Method Summary collapse

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_hashObject


21
22
23
# File 'lib/ice_cube/builders/hash_builder.rb', line 21

def to_hash
  @hash
end

#validationsObject


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