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.
Instance Method Summary collapse
-
#each ⇒ Object
Iterater for each item within the change.
-
#initialize(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(group_name, change, options = {}) ⇒ Item
Returns a new instance of Item.
8 9 10 11 |
# File 'lib/renogen/change_log/item.rb', line 8 def initialize(group_name, change, ={}) @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 |
Instance Method Details
#each ⇒ Object
Iterater for each item within the change
35 36 37 38 39 |
# File 'lib/renogen/change_log/item.rb', line 35 def each change.each do |item| yield item.to_s end end |
#list? ⇒ Boolean
Returns true if change is of type array.
30 31 32 |
# File 'lib/renogen/change_log/item.rb', line 30 def list? change.is_a? Array end |
#to_s ⇒ String
Coverts the item into its string representation
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/renogen/change_log/item.rb', line 16 def to_s case change.class.to_s when String.to_s format_multiline(change) when Hash.to_s format_oneline(change) when Array.to_s format_array(change) else raise TypeError end end |