Class: YamlExtensions::ChopHeader
- Defined in:
- lib/yaml_extensions/chop_header.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
Instance Method Summary collapse
-
#initialize(io) ⇒ ChopHeader
constructor
A new instance of ChopHeader.
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
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
22 23 24 |
# File 'lib/yaml_extensions/chop_header.rb', line 22 def doc @doc end |