Class: Rhdl::DataType
- Inherits:
-
Object
- Object
- Rhdl::DataType
- Defined in:
- lib/rhdl/data_type.rb
Instance Attribute Summary collapse
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, bits, parent) ⇒ DataType
constructor
A new instance of DataType.
- #is_equal_or_child_of(other) ⇒ Object
- #to_s ⇒ Object
- #with_bits(bits) ⇒ Object
Constructor Details
#initialize(name, bits, parent) ⇒ DataType
Returns a new instance of DataType.
5 6 7 8 9 |
# File 'lib/rhdl/data_type.rb', line 5 def initialize(name, bits, parent) @name = name @bits = bits @parent = parent end |
Instance Attribute Details
#bits ⇒ Object (readonly)
Returns the value of attribute bits.
3 4 5 |
# File 'lib/rhdl/data_type.rb', line 3 def bits @bits end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rhdl/data_type.rb', line 3 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/rhdl/data_type.rb', line 3 def parent @parent end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 |
# File 'lib/rhdl/data_type.rb', line 15 def ==(other) name == other.name && bits == other.bits end |
#is_equal_or_child_of(other) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/rhdl/data_type.rb', line 19 def is_equal_or_child_of(other) return false if parent.nil? return true if other == self parent.is_equal_or_child_of(other) end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/rhdl/data_type.rb', line 26 def to_s "#{@name}_#{@bits}" end |