Class: YamlExtensions::ChopHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml_extensions/chop_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ ChopHeader

Returns a new instance of ChopHeader.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/yaml_extensions/chop_header.rb', line 10

def initialize ( io )
  aStr = io.gets
  unless aStr =~ /^---/
    io.rewind
    raise Exception, "First line is not valid: `#{aStr}'"
  end
  io.each do |aLine|
    break if aLine =~ /^---/
    aStr += aLine
  end
  @doc = YAML::load(aStr)
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



22
23
24
# File 'lib/yaml_extensions/chop_header.rb', line 22

def doc
  @doc
end