Sha256: 789e219d3154abba5eec2c5ce0da8c893195bf2dd1af7d66fd3c4ddcc555a83d
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module DataForge module File module CSV class CSVRecordFileDefinition class << self include DataForge::DSL::Attributes end attr_reader :name, :fields define_attribute :file_name define_attribute :delimiter define_attribute :quote define_attribute :encoding define_attribute :has_header_row alias :separator :delimiter def initialize(name) @name = name @file_name = "#{name.to_s}.csv" @fields = {} @delimiter = "," @quote = '"' @encoding = "UTF-8" @has_header_row = true end def field(name, type = String) @fields[name] = type end def without_field(name) @fields.delete name end def field_names @fields.keys end def copy(definition) delimiter definition.delimiter quote definition.quote encoding definition.encoding has_header_row definition.has_header_row definition.fields.each { |name, type| field name, type } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
data_forge-0.1.1 | lib/data_forge/file/csv/csv_record_file_definition.rb |