Class: OrigenTesters::Decompiler::Nodes::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/decompiler/nodes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context:, type:, **nodes) ⇒ Node

Returns a new instance of Node.


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/origen_testers/decompiler/nodes.rb', line 18

def initialize(context:, type:, **nodes)
  @context = context
  if type
    @type = type
  elsif @type.nil?
    type = self.class.underscore
  end

  unless platform_nodes.empty?
    platform_nodes.each do |n|
      define_singleton_method(n) do
        instance_variable_get("@#{n}".to_sym)
      end
    end
  end
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.


5
6
7
# File 'lib/origen_testers/decompiler/nodes.rb', line 5

def context
  @context
end

#typeObject (readonly)

Returns the value of attribute type.


6
7
8
# File 'lib/origen_testers/decompiler/nodes.rb', line 6

def type
  @type
end

Class Method Details

.inherited(subclass) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'lib/origen_testers/decompiler/nodes.rb', line 8

def self.inherited(subclass)
  if subclass.const_defined?(:PLATFORM_NODES)
    subclass.const_get(:PLATFORM_NODES).each do |n|
      subclass.define_instance_method(n) do
        instance_variable_get(":@#{n}")
      end
    end
  end
end

Instance Method Details

#execute?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'lib/origen_testers/decompiler/nodes.rb', line 35

def execute?
  @execute
end

#platform_nodesObject


39
40
41
# File 'lib/origen_testers/decompiler/nodes.rb', line 39

def platform_nodes
  self.class.const_defined?(:PLATFORM_NODES) ? self.class.const_get(:PLATFORM_NODES) : []
end