Class: Wlog::ConcatDescription
- Inherits:
-
Commandable
- Object
- Commandable
- Wlog::ConcatDescription
- Defined in:
- lib/wlog/commands/concat_description.rb
Overview
Concatenate a string to an existing log entry
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#str ⇒ Object
readonly
Returns the value of attribute str.
Instance Method Summary collapse
-
#execute ⇒ Object
Find and update the log entry.
-
#initialize(id, str) ⇒ ConcatDescription
constructor
A new instance of ConcatDescription.
Constructor Details
#initialize(id, str) ⇒ ConcatDescription
Returns a new instance of ConcatDescription.
7 8 9 |
# File 'lib/wlog/commands/concat_description.rb', line 7 def initialize(id, str) @id, @str = id, str end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
20 21 22 |
# File 'lib/wlog/commands/concat_description.rb', line 20 def id @id end |
#str ⇒ Object (readonly)
Returns the value of attribute str.
20 21 22 |
# File 'lib/wlog/commands/concat_description.rb', line 20 def str @str end |
Instance Method Details
#execute ⇒ Object
Find and update the log entry
12 13 14 15 16 17 18 |
# File 'lib/wlog/commands/concat_description.rb', line 12 def execute log_entry = LogEntry.find(@id) log_entry.description += @str log_entry.save rescue ActiveRecord::RecordNotFound false end |