class Bicho::History

A collection of Changesets associated with a bug

Public Class Methods

new(client, data) click to toggle source
# File lib/bicho/history.rb, line 132
def initialize(client, data)
  @client = client
  @data = data
end

Public Instance Methods

bug() click to toggle source

@return [String] The numeric id of the bug

# File lib/bicho/history.rb, line 142
def bug
  @bug = @client.get_bug(@data['id']) unless @bug
  @bug
end
bug_id() click to toggle source
# File lib/bicho/history.rb, line 137
def bug_id
  @data['id']
end
changesets() click to toggle source

@return [Array<ChangeSet>] collection of changesets

# File lib/bicho/history.rb, line 148
def changesets
  @data['history'].map do |changeset|
    ChangeSet.new(@client, changeset)
  end
end
each() { |c| ... } click to toggle source

iterate over each changeset

# 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?() click to toggle source

@return [Boolean] true when there are no changesets

# File lib/bicho/history.rb, line 128
def empty?
  changesets.empty?
end
size() click to toggle source

@return [Fixnum] number of changesets

# File lib/bicho/history.rb, line 123
def size
  changesets.size
end
to_s() click to toggle source
# 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