class Nebulous::Parser
Constants
- DEFAULT_OPTIONS
Attributes
file[R]
options[R]
Public Class Methods
new(file, *args)
click to toggle source
# File lib/nebulous/parser.rb, line 22 def initialize(file, *args) opts = args.extract_options! @options = OpenStruct.new DEFAULT_OPTIONS.merge(opts) @file = read_input(file) merge_delimiters end
Public Instance Methods
headers()
click to toggle source
# File lib/nebulous/parser.rb, line 31 def headers @file.rewind raw_headers end
process(&block)
click to toggle source
# File lib/nebulous/parser.rb, line 36 def process(&block) @index = 0 read_headers if options[:headers] iterate(&block) ensure reset file.rewind end
Private Instance Methods
reset()
click to toggle source
# File lib/nebulous/parser.rb, line 47 def reset @index = 0 @headers = nil @chunk = nil end