class Quandl::Format::Abstract
Public Class Methods
each_line_as_node(interface, &block)
click to toggle source
# File lib/quandl/format/abstract.rb, line 21 def each_line_as_node(interface, &block) # initialize an empty node node = self::Node.new( block: block ) # for each_line of the interface interface.each_line do |line| # add the line to the node node = node.add( line ) end # we're done node.close end
foreach(interface, &block)
click to toggle source
# File lib/quandl/format/abstract.rb, line 15 def foreach(interface, &block) each_line_as_node(interface) do |node| call_and_catch_block(node, &block) end end
load(interface)
click to toggle source
# File lib/quandl/format/abstract.rb, line 9 def load(interface) output = [] foreach(interface){|n| output << n } output end
Protected Class Methods
before_call(node)
click to toggle source
# File lib/quandl/format/abstract.rb, line 45 def before_call(node) node end
call_and_catch_block(node, &block)
click to toggle source
# File lib/quandl/format/abstract.rb, line 36 def call_and_catch_block(node, &block) # convert the node to an instance of superset node = before_call(node) # pass the superset to the block block.call( node ) rescue Exception => error block.call( error ) end