Class: Pickler::Tracker::Note
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Abstract
accessor, date_reader, #id, reader
Constructor Details
#initialize(story, attributes = {}) ⇒ Note
Returns a new instance of Note.
12
13
14
15
|
# File 'lib/pickler/tracker/note.rb', line 12
def initialize(story, attributes = {})
@story = story
super(attributes)
end
|
Instance Attribute Details
#story ⇒ Object
Returns the value of attribute story.
4
5
6
|
# File 'lib/pickler/tracker/note.rb', line 4
def story
@story
end
|
Instance Method Details
#date ⇒ Object
8
9
10
|
# File 'lib/pickler/tracker/note.rb', line 8
def date
noted_at && Date.new(noted_at.year, noted_at.mon, noted_at.day)
end
|
#inspect ⇒ Object
21
22
23
|
# File 'lib/pickler/tracker/note.rb', line 21
def inspect
"#<#{self.class.inspect}:#{id.inspect}, story_id: #{story.id.inspect}, date: #{date.inspect}, author: #{author.inspect}, text: #{text.inspect}>"
end
|
#lines(width = 79) ⇒ Object
25
26
27
|
# File 'lib/pickler/tracker/note.rb', line 25
def lines(width = 79)
text.scan(/(?:.{0,#{width}}|\S+?)(?:\s|$)/).map! {|line| line.strip}[0..-2]
end
|
#to_xml ⇒ Object
17
18
19
|
# File 'lib/pickler/tracker/note.rb', line 17
def to_xml
@attributes.to_xml(:dasherize => false, :root => 'note')
end
|