Class: SimpleRewriter::Reader

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

Constant Summary collapse

INDEX_OF_ATTRIBUTE_NAME =
0

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record, attributes) ⇒ Reader

Returns a new instance of Reader.



8
9
10
11
# File 'lib/simple_rewriter/reader.rb', line 8

def initialize(record, attributes)
  @record = record
  @attributes = attributes
end

Class Method Details

.call(record, attributes) ⇒ Object



4
5
6
# File 'lib/simple_rewriter/reader.rb', line 4

def self.call(record, attributes)
  new(record, attributes).call { |data| yield(data) }
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
# File 'lib/simple_rewriter/reader.rb', line 13

def call
  attributes.each do |attribute_with_options|
    @attribute_with_options = attribute_with_options

    yield [attribute, attr_value, options]
  end
end