Module: Dcf

Defined in:
lib/dcf.rb

Class Method Summary collapse

Class Method Details

.parse(input) ⇒ Array?

Returns An array of { attr => val } hashes or nil if failure.

Parameters:

  • input (String)

Returns:

  • (Array, nil)

    An array of { attr => val } hashes or nil if failure



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dcf.rb', line 8

def self.parse(input)
  parse = DcfParser.new.parse(input)
  return if parse.nil?

  parse.elements.collect do |i|
    paragraph = {}
    i.paragraph.elements.each do |row|
      paragraph[row.field.attribute.text_value] = row.field.value.text_value
    end
    paragraph
  end
end

.versionObject



21
22
23
# File 'lib/dcf.rb', line 21

def self.version
  "0.2.1"
end