Class: Bicho::ChangeSet
- Inherits:
-
Object
- Object
- Bicho::ChangeSet
- Includes:
- Enumerable
- Defined in:
- lib/bicho/history.rb
Overview
A collection of related changes.
Instance Method Summary collapse
-
#changes ⇒ Array<Change>
List of changes, with details of what changed.
-
#date ⇒ Object
deprecated
Deprecated.
Use #timestamp instead
-
#initialize(client, data) ⇒ ChangeSet
constructor
A new instance of ChangeSet.
-
#timestamp ⇒ Object
return [Date] The date the bug activity/change happened.
- #to_h ⇒ Object
- #to_s ⇒ Object
-
#who ⇒ String
The login name of the user who performed the bug change.
Constructor Details
#initialize(client, data) ⇒ ChangeSet
Returns a new instance of ChangeSet.
91 92 93 94 |
# File 'lib/bicho/history.rb', line 91 def initialize(client, data) @client = client @data = data end |
Instance Method Details
#changes ⇒ Array<Change>
Returns list of changes, with details of what changed.
85 86 87 88 89 |
# File 'lib/bicho/history.rb', line 85 def changes @data['changes'].map do |change| Change.new(@client, change) end end |
#date ⇒ Object
Deprecated.
Use #timestamp instead
return [Date] The date the bug activity/change happened.
69 70 71 72 |
# File 'lib/bicho/history.rb', line 69 def date warn 'Deprecated. Use timestamp instead' end |
#timestamp ⇒ Object
return [Date] The date the bug activity/change happened.
75 76 77 |
# File 'lib/bicho/history.rb', line 75 def @data['when'].to_time end |
#to_h ⇒ Object
105 106 107 |
# File 'lib/bicho/history.rb', line 105 def to_h { who: who, timestamp: , changes: changes.map(&:to_h) } end |
#to_s ⇒ Object
96 97 98 99 100 101 102 103 |
# File 'lib/bicho/history.rb', line 96 def to_s buffer = StringIO.new buffer << "#{}- #{who}\n" changes.each do |diff| buffer << "#{diff}\n" end buffer.string end |
#who ⇒ String
Returns The login name of the user who performed the bug change.
80 81 82 |
# File 'lib/bicho/history.rb', line 80 def who @data['who'] end |