Class: MilkTea::Types::Quaternion
- Defined in:
- lib/milk_tea/core/types/types.rb
Constant Summary collapse
- FIELD_NAMES =
%w[x y z w].freeze
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #field(name) ⇒ Object
- #fields ⇒ Object
-
#initialize(name) ⇒ Quaternion
constructor
A new instance of Quaternion.
- #numeric? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #children, #field_c_name, #float?, #integer?, #sendable?, #void?
Constructor Details
#initialize(name) ⇒ Quaternion
Returns a new instance of Quaternion.
1483 1484 1485 1486 1487 1488 1489 1490 1491 |
# File 'lib/milk_tea/core/types/types.rb', line 1483 def initialize(name) @name = name @module_name = nil @fields = FIELD_NAMES.each_with_object({}) do |fname, h| h[fname] = BUILTIN_VECTOR_ELEMENT end.freeze @hash = [self.class, name].hash freeze end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
1499 1500 1501 |
# File 'lib/milk_tea/core/types/types.rb', line 1499 def hash @hash end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
1479 1480 1481 |
# File 'lib/milk_tea/core/types/types.rb', line 1479 def module_name @module_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1479 1480 1481 |
# File 'lib/milk_tea/core/types/types.rb', line 1479 def name @name end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
1493 1494 1495 |
# File 'lib/milk_tea/core/types/types.rb', line 1493 def eql?(other) other.is_a?(Quaternion) && other.name == name end |
#field(name) ⇒ Object
1505 1506 1507 |
# File 'lib/milk_tea/core/types/types.rb', line 1505 def field(name) @fields[name] end |
#fields ⇒ Object
1501 1502 1503 |
# File 'lib/milk_tea/core/types/types.rb', line 1501 def fields @fields end |
#numeric? ⇒ Boolean
1509 1510 1511 |
# File 'lib/milk_tea/core/types/types.rb', line 1509 def numeric? true end |
#to_s ⇒ Object
1514 1515 1516 |
# File 'lib/milk_tea/core/types/types.rb', line 1514 def to_s name end |