lib/csv2hash/definition.rb in csv2hash-0.6.1 vs lib/csv2hash/definition.rb in csv2hash-0.6.2
- old
+ new
@@ -36,20 +36,18 @@
def set_structure_rules &blk
self.structure_rules = yield if block_given?
end
def validate!
- # binding.pry
unless TYPES.include?(@type)
raise "not suitable type, please use '#{MAPPING}' or '#{COLLECTION}'"
end
raise 'cells must be an Array of cell' unless self.cells.class == Array
raise 'structure rules must be a Hash of rules' unless self.structure_rules.class == Hash
end
def default!
- # binding.pry
cells.each do |cell|
cell.rules.fetch(:position)
default_position cell
unless cell.rules.has_key? :message
@@ -64,10 +62,9 @@
cell.rules.merge! values: nil unless cell.rules.has_key? :values
cell.rules.merge! nested: nil unless cell.rules.has_key? :nested
cell.rules.merge! allow_blank: false unless cell.rules.has_key? :allow_blank
cell.rules.merge! extra_validator: nil unless cell.rules.has_key? :extra_validator
end
- # binding.pry
end
private
def default_position cell