class Rdv::Object::Block
Attributes
list[RW]
name[RW]
raw_list[RW]
Public Class Methods
new(header)
click to toggle source
# File lib/rdv/object/block.rb, line 6 def initialize header @name = capitalize(header) @raw_list = [] end
Public Instance Methods
add_line(line)
click to toggle source
# File lib/rdv/object/block.rb, line 11 def add_line(line) @raw_list << line end
build()
click to toggle source
# File lib/rdv/object/block.rb, line 15 def build @list = @raw_list.reduce([]) do |list, line| line = trim_indentation(line) if line.match(/^[^\s]+/) list << Item.new(line) elsif list.length > 0 && line.length > 0 list.last.add_line(line) end list end @list.each(&:build) @name = clean(@name) end