Class: Railslog::Entry
- Inherits:
-
Object
- Object
- Railslog::Entry
- Defined in:
- lib/railslog.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
- #add_line(text) ⇒ Object
-
#initialize(entry_text) ⇒ Entry
constructor
A new instance of Entry.
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
72 73 74 |
# File 'lib/railslog.rb', line 72 def @author end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
72 73 74 |
# File 'lib/railslog.rb', line 72 def text @text end |
Class Method Details
.recognize?(line) ⇒ Boolean
74 75 76 |
# File 'lib/railslog.rb', line 74 def self.recognize?(line) line =~ /^\*\s+/ end |
Instance Method Details
#add_line(text) ⇒ Object
83 84 85 86 87 |
# File 'lib/railslog.rb', line 83 def add_line(text) text.gsub!(/[\r\n]/, '') @text << "\n#{text}" @author = (text) || @author end |
#to_s ⇒ Object
89 90 91 |
# File 'lib/railslog.rb', line 89 def to_s "<#{self.class} author:#{@author} text:#{truncated_text}>" end |