Class: RDFgrid::Mapper::LineMapper

Inherits:
show all
Defined in:
lib/rdfgrid/mapper.rb

Constant Summary

Constants inherited from RDFgrid::Processor

SEPARATOR

Class Method Summary

Instance Method Summary

Methods inherited from

#call

Methods inherited from RDFgrid::Processor

#initialize, process!

Constructor Details

This class inherits a constructor from RDFgrid::Processor

Class Method Details

+ process(input, options = {}, &block)

This method returns an undefined value.

Parameters:

  • (IO, File, #each_line) input
  • (Hash{Symbol => Object}) options (defaults to: {})


27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rdfgrid/mapper.rb', line 27

def self.process(input, options = {}, &block)
  mapper = self.new(options)
  count  = 0
  input.each_line do |line|
    if block_given?
      mapper.call(count += 1, line, &block)
    else
      mapper.call(count += 1, line) do |key, value|
        puts [key, value].join(SEPARATOR)
      end
    end
  end
end

Instance Method Details

- process(line, &block)

This method is abstract.

This method returns an undefined value.

Parameters:

  • (String) line


45
46
47
# File 'lib/rdfgrid/mapper.rb', line 45

def process(line, &block)
  super
end