Class: Origen::Tests::Test
- Includes:
- Limits
- Defined in:
- lib/origen/tests/test.rb
Constant Summary
Constants included from Limits
Instance Attribute Summary collapse
-
#conditions ⇒ Object
Returns the value of attribute conditions.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#platforms ⇒ Object
Returns the value of attribute platforms.
Instance Method Summary collapse
-
#initialize(id, options = {}, &block) ⇒ Test
constructor
A new instance of Test.
- #method_missing(m, *args, &block) ⇒ Object
- #name ⇒ Object
Methods included from Limits
Constructor Details
#initialize(id, options = {}, &block) ⇒ Test
Returns a new instance of Test.
9 10 11 12 13 14 15 16 17 |
# File 'lib/origen/tests/test.rb', line 9 def initialize(id, = {}, &block) @id = id @description = '' @conditions, @platforms = [], [] @id = @id.symbolize unless @id.is_a? Symbol .each { |k, v| instance_variable_set("@#{k}", v) } (block.arity < 1 ? (instance_eval(&block)) : block.call(self)) if block_given? fail unless attrs_ok? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/origen/tests/test.rb', line 23 def method_missing(m, *args, &block) ivar = "@#{m.to_s.gsub('=', '')}" ivar_sym = ":#{ivar}" if m.to_s =~ /=$/ define_singleton_method(m) do |val| instance_variable_set(ivar, val) end elsif instance_variables.include? ivar_sym instance_variable_get(ivar) else define_singleton_method(m) do instance_variable_get(ivar) end end send(m, *args, &block) end |
Instance Attribute Details
#conditions ⇒ Object
Returns the value of attribute conditions.
7 8 9 |
# File 'lib/origen/tests/test.rb', line 7 def conditions @conditions end |
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/origen/tests/test.rb', line 7 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/origen/tests/test.rb', line 7 def id @id end |
#owner ⇒ Object
Returns the value of attribute owner.
7 8 9 |
# File 'lib/origen/tests/test.rb', line 7 def owner @owner end |
#platforms ⇒ Object
Returns the value of attribute platforms.
7 8 9 |
# File 'lib/origen/tests/test.rb', line 7 def platforms @platforms end |
Instance Method Details
#name ⇒ Object
19 20 21 |
# File 'lib/origen/tests/test.rb', line 19 def name @id end |