Class: Shiftzilla::Bug

Inherits:
Object
  • Object
show all
Defined in:
lib/shiftzilla/bug.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bzid, binfo) ⇒ Bug

Returns a new instance of Bug.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/shiftzilla/bug.rb', line 5

def initialize(bzid,binfo)
  @id           = bzid
  @first_seen   = binfo[:snapdate]
  @last_seen    = binfo[:snapdate]
  @test_blocker = binfo[:test_blocker]
  @ops_blocker  = binfo[:ops_blocker]
  @owner        = binfo[:owner]
  @summary      = binfo[:summary]
  @component    = binfo[:component]
  @pm_score     = binfo[:pm_score]
  @cust_cases   = binfo[:cust_cases]
  @tgt_release  = binfo[:tgt_release]
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def component
  @component
end

#cust_casesObject (readonly)

Returns the value of attribute cust_cases.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def cust_cases
  @cust_cases
end

#first_seenObject (readonly)

Returns the value of attribute first_seen.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def first_seen
  @first_seen
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def id
  @id
end

#last_seenObject (readonly)

Returns the value of attribute last_seen.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def last_seen
  @last_seen
end

#ops_blockerObject (readonly)

Returns the value of attribute ops_blocker.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def ops_blocker
  @ops_blocker
end

#ownerObject (readonly)

Returns the value of attribute owner.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def owner
  @owner
end

#pm_scoreObject (readonly)

Returns the value of attribute pm_score.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def pm_score
  @pm_score
end

#test_blockerObject (readonly)

Returns the value of attribute test_blocker.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def test_blocker
  @test_blocker
end

#tgt_releaseObject (readonly)

Returns the value of attribute tgt_release.



3
4
5
# File 'lib/shiftzilla/bug.rb', line 3

def tgt_release
  @tgt_release
end

Instance Method Details

#ageObject



35
36
37
# File 'lib/shiftzilla/bug.rb', line 35

def age
  (@last_seen - @first_seen).to_i
end

#semverObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/shiftzilla/bug.rb', line 39

def semver
  parts = @tgt_release.split('.')
  if parts.length == 1
    return @tgt_release
  end
  semver = ''
  first_part = true
  parts.each do |part|
    unless is_number?(part)
      semver += part
    else
      semver += ("%09d" % part).to_s
    end
    # A version like '3.z' gets a middle 0 for sort purposes.
    if first_part and parts.length == 2
      semver += ("%09d" % 0).to_s
    end
    first_part = false
  end
  return semver
end

#summaryObject



31
32
33
# File 'lib/shiftzilla/bug.rb', line 31

def summary
  @summary[0..30].gsub(/\s\w+\s*$/, '...')
end

#update(binfo) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/shiftzilla/bug.rb', line 19

def update(binfo)
  @last_seen    = binfo[:snapdate]
  @test_blocker = binfo[:test_blocker]
  @ops_blocker  = binfo[:ops_blocker]
  @owner        = binfo[:owner]
  @summary      = binfo[:summary]
  @component    = binfo[:component]
  @pm_score     = binfo[:pm_score]
  @cust_cases   = binfo[:cust_cases]
  @tgt_release  = binfo[:tgt_release]
end