Class: MilkTea::Types::Quaternion
- Defined in:
- lib/milk_tea/core/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.
1477 1478 1479 1480 1481 1482 1483 1484 1485 |
# File 'lib/milk_tea/core/types.rb', line 1477 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.
1493 1494 1495 |
# File 'lib/milk_tea/core/types.rb', line 1493 def hash @hash end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
1473 1474 1475 |
# File 'lib/milk_tea/core/types.rb', line 1473 def module_name @module_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1473 1474 1475 |
# File 'lib/milk_tea/core/types.rb', line 1473 def name @name end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
1487 1488 1489 |
# File 'lib/milk_tea/core/types.rb', line 1487 def eql?(other) other.is_a?(Quaternion) && other.name == name end |
#field(name) ⇒ Object
1499 1500 1501 |
# File 'lib/milk_tea/core/types.rb', line 1499 def field(name) @fields[name] end |
#fields ⇒ Object
1495 1496 1497 |
# File 'lib/milk_tea/core/types.rb', line 1495 def fields @fields end |
#numeric? ⇒ Boolean
1503 1504 1505 |
# File 'lib/milk_tea/core/types.rb', line 1503 def numeric? true end |
#to_s ⇒ Object
1508 1509 1510 |
# File 'lib/milk_tea/core/types.rb', line 1508 def to_s name end |