Class: Origen::Bugs::Bug

Inherits:
Object show all
Defined in:
lib/origen/bugs/bug.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Bug

Returns a new instance of Bug.



9
10
11
12
13
# File 'lib/origen/bugs/bug.rb', line 9

def initialize(name, options = {})
  @name = name
  @affected_versions = [options[:affected_version] || options[:affected_versions]].flatten.compact
  @fixed_on_version = options[:fixed_on_version]
end

Instance Attribute Details

#affected_versionsObject (readonly)

Returns the value of attribute affected_versions.



4
5
6
# File 'lib/origen/bugs/bug.rb', line 4

def affected_versions
  @affected_versions
end

#nameObject (readonly) Also known as: id

Returns the value of attribute name.



6
7
8
# File 'lib/origen/bugs/bug.rb', line 6

def name
  @name
end

Instance Method Details

#fixed_on_versionObject



27
28
29
30
31
32
33
# File 'lib/origen/bugs/bug.rb', line 27

def fixed_on_version
  @fixed_on_version || begin
    unless affected_versions.empty?
      affected_versions.max + 1
    end
  end
end

#present_on_version?(version, _options = {}) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
24
25
# File 'lib/origen/bugs/bug.rb', line 15

def present_on_version?(version, _options = {})
  if affected_versions.empty?
    if fixed_on_version
      version < fixed_on_version
    else
      true
    end
  else
    affected_versions.include?(version)
  end
end