Class: Origen::Tester::Doc::Generator::Test
- Inherits:
-
Object
- Object
- Origen::Tester::Doc::Generator::Test
- Defined in:
- lib/origen/tester/doc/generator/test.rb
Instance Attribute Summary (collapse)
-
- (Object) append_version
Returns the value of attribute append_version.
-
- (Object) attributes
Returns the value of attribute attributes.
-
- (Object) index
Returns the value of attribute index.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) version
Returns the value of attribute version.
Instance Method Summary (collapse)
- - (Object) ==(other_test)
- - (Object) attributes_to_yaml(_options = {})
-
- (Test) initialize(name, attrs = {})
constructor
A new instance of Test.
- - (Object) method_missing(method, *args, &_block)
- - (Object) to_yaml(options = {})
- - (Object) unversioned_name
Constructor Details
- (Test) initialize(name, attrs = {})
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
- (Object) method_missing(method, *args, &_block)
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
- (Object) append_version
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 |
- (Object) attributes
Returns the value of attribute attributes
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def attributes @attributes end |
- (Object) index
Returns the value of attribute index
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def index @index end |
- (Object) name
Returns the value of attribute name
6 7 8 |
# File 'lib/origen/tester/doc/generator/test.rb', line 6 def name @name end |
- (Object) version
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
- (Object) ==(other_test)
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 |
- (Object) attributes_to_yaml(_options = {})
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 |
- (Object) to_yaml(options = {})
22 23 24 25 26 |
# File 'lib/origen/tester/doc/generator/test.rb', line 22 def to_yaml( = {}) { 'attributes' => attributes_to_yaml() } end |
- (Object) unversioned_name
61 62 63 |
# File 'lib/origen/tester/doc/generator/test.rb', line 61 def unversioned_name @name.to_s end |