class Line

Constants

TYPES

Attributes

fields[RW]
text[RW]
type[RW]

Public Class Methods

new(args) click to toggle source

sets the types, and fields we can have processing based on line.

# File lib/ruby_astm/line.rb, line 32
def initialize(args)
        self.fields = []
        raise "no text provided" unless args[:text]
        if args[:text]
                args[:text].split(/\|/).each do |field|
                        self.fields << field
                end
        end
        detect_type
end

Public Instance Methods

detect_type() click to toggle source
# File lib/ruby_astm/line.rb, line 43
def detect_type
        #puts "detecting line type: #{self.text}"
        line_type = self.fields[0]
        return unless line_type
        line_type.scan(/(?<ltype>[A-Z]+)/) { |ltype| 
                if Line::TYPES[ltype[0]]
                        self.type = Line::TYPES[ltype[0]]
                end
        }             

end