Module: Origen::Bugs

Extended by:
ActiveSupport::Concern
Defined in:
lib/origen/bugs.rb,
lib/origen/bugs/bug.rb

Defined Under Namespace

Modules: ClassMethods Classes: Bug

Instance Method Summary collapse

Instance Method Details

#bugsObject

Returns a hash containing all known bugs associated with the given IP, regardless of which version they are present on



47
48
49
# File 'lib/origen/bugs.rb', line 47

def bugs
  self.class.bugs
end

#has_bug?(name, _options = {}) ⇒ Boolean

Returns true if the IP represented by the object has the bug of the given name. Bugs explicitly declared with unfixable: true can be queried without a version attribute.

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/origen/bugs.rb', line 26

def has_bug?(name, _options = {})
  name = name.to_s.downcase.to_sym

  if bug = bugs[name]
    return true if bug.unfixable?

    # Note - jinyakok: Only check for version if a bug actually exists.
    unless respond_to?(:version) && version
      puts 'To test for the presence of a versioned bug the object must implement an attribute'
      puts "called 'version' which returns the IP version represented by the the object."
      fail 'Version undefined!'
    end

    bug.present_on_version?(version)
  else
    false
  end
end