class Rdv::Object::Item
Attributes
content[RW]
name[RW]
raw_content[RW]
user[RW]
Public Class Methods
new(name)
click to toggle source
# File lib/rdv/object/item.rb, line 6 def initialize name @name = name @raw_content = [] @tags = [] end
Public Instance Methods
add_line(line)
click to toggle source
# File lib/rdv/object/item.rb, line 12 def add_line line @raw_content << line end
build()
click to toggle source
# File lib/rdv/object/item.rb, line 16 def build # Clean name and store it back @name = clean(@name.strip) # Fetch contents contents = @raw_content.reduce([]) do |list, line| line = trim_indentation(line) list << line list end.join("").strip.lines if contents.last.match(/^\|/) @tags = contents.pop.split("|")[1..-1].map do |tag| capitalize(tag) end.compact end @content = contents.join # If a @user tag is found in the issue name, strip it and store it as # the assignee user login if (user = @name.match(/@(\w+)$/)) @user = user[1] # Clean username from item name @name = @name.gsub(/@(\w+)$/, "").strip end end