Class: Bicho::History
- Inherits:
-
Object
- Object
- Bicho::History
- Includes:
- Enumerable
- Defined in:
- lib/bicho/history.rb
Overview
A collection of Changesets associated with a bug
Instance Method Summary collapse
-
#bug ⇒ String
The numeric id of the bug.
- #bug_id ⇒ Object
-
#changesets ⇒ Array<ChangeSet>
Collection of changesets.
-
#each ⇒ Object
iterate over each changeset.
-
#empty? ⇒ Boolean
True when there are no changesets.
-
#initialize(client, data) ⇒ History
constructor
A new instance of History.
-
#size ⇒ Fixnum
Number of changesets.
- #to_s ⇒ Object
Constructor Details
#initialize(client, data) ⇒ History
Returns a new instance of History.
132 133 134 135 |
# File 'lib/bicho/history.rb', line 132 def initialize(client, data) @client = client @data = data end |
Instance Method Details
#bug ⇒ String
Returns The numeric id of the bug.
142 143 144 145 |
# File 'lib/bicho/history.rb', line 142 def bug @bug = @client.get_bug(@data['id']) unless @bug @bug end |
#bug_id ⇒ Object
137 138 139 |
# File 'lib/bicho/history.rb', line 137 def bug_id @data['id'] end |
#changesets ⇒ Array<ChangeSet>
Returns collection of changesets.
148 149 150 151 152 |
# File 'lib/bicho/history.rb', line 148 def changesets @data['history'].map do |changeset| ChangeSet.new(@client, changeset) end end |
#each ⇒ Object
iterate over each changeset
115 116 117 118 119 120 |
# File 'lib/bicho/history.rb', line 115 def each return enum_for(:each) unless block_given? changesets.each do |c| yield c end end |
#empty? ⇒ Boolean
Returns true when there are no changesets.
128 129 130 |
# File 'lib/bicho/history.rb', line 128 def empty? changesets.empty? end |
#size ⇒ Fixnum
Returns number of changesets.
123 124 125 |
# File 'lib/bicho/history.rb', line 123 def size changesets.size end |
#to_s ⇒ Object
154 155 156 157 158 159 160 161 |
# File 'lib/bicho/history.rb', line 154 def to_s buffer = StringIO.new buffer << "#{bug_id}\n" changesets.each do |cs| buffer << "#{cs}\n" end buffer.string end |