Class: Origen::Tester::Doc::Generator::Test
- Defined in:
- lib/origen/tester/doc/generator/test.rb
Instance Attribute Summary collapse
-
#append_version ⇒ Object
Returns the value of attribute append_version.
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#index ⇒ Object
Returns the value of attribute index.
-
#name ⇒ Object
Returns the value of attribute name.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #==(other_test) ⇒ Object
- #attributes_to_yaml(_options = {}) ⇒ Object
-
#initialize(name, attrs = {}) ⇒ Test
constructor
A new instance of Test.
- #method_missing(method, *args, &_block) ⇒ Object
- #to_yaml(options = {}) ⇒ Object
- #unversioned_name ⇒ Object
Constructor Details
#initialize(name, attrs = {}) ⇒ Test
Returns a new instance of Test.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/origen/tester/doc/generator/test.rb', line 8 def initialize(name, attrs = {}) attrs = {}.merge(attrs) # Important to keep this to clone the original options # so that the caller's copy if not affected by stripping # out the flow/relation options @attributes = {} @append_version = true self.name = name Origen.interface.(attrs) Origen.interface.(attrs) attrs.each do |attribute, val| @attributes[attribute] = val end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &_block) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/origen/tester/doc/generator/test.rb', line 37 def method_missing(method, *args, &_block) method = method.to_s if method.gsub!('=', '') @attributes[method] = args.first else @attributes[method] end end |
Instance Attribute Details
#append_version ⇒ Object
Returns the value of attribute append_version.
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def append_version @append_version end |
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def attributes @attributes end |
#index ⇒ Object
Returns the value of attribute index.
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def index @index end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def name @name end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def version @version end |
Instance Method Details
#==(other_test) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/origen/tester/doc/generator/test.rb', line 46 def ==(other_test) self.class == other_test.class && unversioned_name.to_s == other_test.unversioned_name.to_s && attributes.size == other_test.attributes.size && attributes.all? { |name, val| other_test.attributes[name] == val } end |
#attributes_to_yaml(_options = {}) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/origen/tester/doc/generator/test.rb', line 28 def attributes_to_yaml( = {}) a = {} @attributes.each do |name, val| a[name.to_s] = val if val end a['name'] = name a end |
#to_yaml(options = {}) ⇒ Object
22 23 24 25 26 |
# File 'lib/origen/tester/doc/generator/test.rb', line 22 def to_yaml( = {}) { 'attributes' => attributes_to_yaml() } end |
#unversioned_name ⇒ Object
61 62 63 |
# File 'lib/origen/tester/doc/generator/test.rb', line 61 def unversioned_name @name.to_s end |