Class: Bound::BoundValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/bound.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, overwrite) ⇒ BoundValidator

Returns a new instance of BoundValidator.



36
37
38
39
# File 'lib/bound.rb', line 36

def initialize(target, overwrite)
  @target = target
  @overwrite = overwrite
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



34
35
36
# File 'lib/bound.rb', line 34

def attributes
  @attributes
end

#nested_array_attributesObject

Returns the value of attribute nested_array_attributes.



34
35
36
# File 'lib/bound.rb', line 34

def nested_array_attributes
  @nested_array_attributes
end

#optional_attributesObject

Returns the value of attribute optional_attributes.



34
35
36
# File 'lib/bound.rb', line 34

def optional_attributes
  @optional_attributes
end

Instance Method Details

#validate!Object



41
42
43
44
45
46
47
48
49
# File 'lib/bound.rb', line 41

def validate!
  ensure_all_attributes_are_known!
  attributes.each do |attribute|
    ensure_present! attribute
  end
  nested_array_attributes.each do |nested_array_attribute|
    ensure_array! nested_array_attribute
  end
end