Class: ActiveRecord::Import::ValueSetsRecordsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-import/value_sets_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values, options) ⇒ ValueSetsRecordsParser

Returns a new instance of ValueSetsRecordsParser.


72
73
74
75
# File 'lib/activerecord-import/value_sets_parser.rb', line 72

def initialize(values, options)
  @values = values
  @max_records = options[:max_records]
end

Instance Attribute Details

#max_recordsObject (readonly)

Returns the value of attribute max_records.


66
67
68
# File 'lib/activerecord-import/value_sets_parser.rb', line 66

def max_records
  @max_records
end

#valuesObject (readonly)

Returns the value of attribute values.


66
67
68
# File 'lib/activerecord-import/value_sets_parser.rb', line 66

def values
  @values
end

Class Method Details

.parse(values, options) ⇒ Object


68
69
70
# File 'lib/activerecord-import/value_sets_parser.rb', line 68

def self.parse(values, options)
  new(values, options).parse
end

Instance Method Details

#parseObject


77
78
79
# File 'lib/activerecord-import/value_sets_parser.rb', line 77

def parse
  @values.in_groups_of(max_records, false)
end