Class: Renogen::ChangeLog::Item
- Inherits:
-
Object
- Object
- Renogen::ChangeLog::Item
- Defined in:
- lib/renogen/change_log/item.rb
Overview
Object to represent single change item
Instance Attribute Summary collapse
-
#change ⇒ Object
Returns the value of attribute change.
-
#group_name ⇒ Object
readonly
Returns the value of attribute group_name.
-
#ticket_id ⇒ Object
readonly
Returns the value of attribute ticket_id.
Instance Method Summary collapse
-
#each ⇒ Object
Iterater for each item within the change.
-
#initialize(ticket_id, group_name, change, options = {}) ⇒ Item
constructor
A new instance of Item.
-
#list? ⇒ Boolean
True if change is of type array.
-
#to_s ⇒ String
Coverts the item into its string representation.
Constructor Details
#initialize(ticket_id, group_name, change, options = {}) ⇒ Item
8 9 10 11 12 |
# File 'lib/renogen/change_log/item.rb', line 8 def initialize(ticket_id, group_name, change, ={}) @ticket_id = ticket_id @group_name = group_name @change = change end |
Instance Attribute Details
#change ⇒ Object
Returns the value of attribute change.
5 6 7 |
# File 'lib/renogen/change_log/item.rb', line 5 def change @change end |
#group_name ⇒ Object (readonly)
Returns the value of attribute group_name.
6 7 8 |
# File 'lib/renogen/change_log/item.rb', line 6 def group_name @group_name end |
#ticket_id ⇒ Object (readonly)
Returns the value of attribute ticket_id.
6 7 8 |
# File 'lib/renogen/change_log/item.rb', line 6 def ticket_id @ticket_id end |
Instance Method Details
#each ⇒ Object
Iterater for each item within the change
38 39 40 41 42 |
# File 'lib/renogen/change_log/item.rb', line 38 def each change.each do |item| yield item.to_s end end |
#list? ⇒ Boolean
33 34 35 |
# File 'lib/renogen/change_log/item.rb', line 33 def list? change.is_a? Array end |
#to_s ⇒ String
Coverts the item into its string representation
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/renogen/change_log/item.rb', line 17 def to_s return '' unless change case change.class.to_s when 'String' format_multiline(change) when 'Hash' format_oneline(change) when 'Array' format_array(change) else raise TypeError end end |