Class: Bicho::ChangeSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bicho/history.rb

Overview

A collection of related changes.

Instance Method Summary collapse

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

#changesArray<Change>

Returns list of changes, with details of what changed.

Returns:

  • (Array<Change>)

    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

#dateObject

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'
  timestamp
end

#timestampObject

return [Date] The date the bug activity/change happened.



75
76
77
# File 'lib/bicho/history.rb', line 75

def timestamp
  @data['when'].to_time
end

#to_hObject



105
106
107
# File 'lib/bicho/history.rb', line 105

def to_h
  { who: who, timestamp: timestamp, changes: changes.map(&:to_h) }
end

#to_sObject



96
97
98
99
100
101
102
103
# File 'lib/bicho/history.rb', line 96

def to_s
  buffer = StringIO.new
  buffer << "#{timestamp}- #{who}\n"
  changes.each do |diff|
    buffer << "#{diff}\n"
  end
  buffer.string
end

#whoString

Returns The login name of the user who performed the bug change.

Returns:

  • (String)

    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