Class: Bicho::Change

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

Overview

Represents a single change inside a bug. History has multiple ChangeSets, and they have multiple changes.

Instance Method Summary collapse

Constructor Details

#initialize(client, data) ⇒ Change

Returns a new instance of Change.



53
54
55
56
# File 'lib/bicho/history.rb', line 53

def initialize(client, data)
  @client = client
  @data = data
end

Instance Method Details

#addedObject



42
43
44
# File 'lib/bicho/history.rb', line 42

def added
  @data['added']
end

#field_nameObject



34
35
36
# File 'lib/bicho/history.rb', line 34

def field_name
  @data['field_name']
end

#removedObject



38
39
40
# File 'lib/bicho/history.rb', line 38

def removed
  @data['removed']
end

#to_hObject



58
59
60
# File 'lib/bicho/history.rb', line 58

def to_h
  @data
end

#to_sObject



46
47
48
49
50
51
# File 'lib/bicho/history.rb', line 46

def to_s
  buffer = StringIO.new
  buffer << "- #{field_name} = #{removed}\n"
  buffer << "+ #{field_name} = #{added}"
  buffer.string
end