lib/recite_csv/header/definition.rb in recite_csv-0.1.2 vs lib/recite_csv/header/definition.rb in recite_csv-0.2.0
- old
+ new
@@ -48,10 +48,11 @@
class Array < Base
class ColumnMethodsBuilder < ::Module
def initialize(raw_definition)
raw_definition.each.with_index do |name, idx|
next if name.nil? || name.empty?
+
define_method name do
self[idx]
end
end
end
@@ -70,9 +71,10 @@
header_definition.is_a? klass
end
unless definition_class
raise ::ArgumentError, "Unexpected header definition type"
end
+
definition_class.new(header_definition)
end
end
end
end