Class: Factorix::SerDes::SignedInteger
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Factorix::SerDes::SignedInteger
- Defined in:
- lib/factorix/ser_des/signed_integer.rb,
sig/factorix/ser_des/signed_integer.rbs
Overview
Signed integer wrapper
This class wraps an Integer value to indicate it was originally stored as a signed integer (Type 6) in Factorio's Property Tree format.
Instance Method Summary collapse
- #% ⇒ Numeric
- #* ⇒ Numeric
- #** ⇒ Numeric
-
#+ ⇒ Numeric
Delegated Integer methods.
- #- ⇒ Numeric
- #/ ⇒ Numeric
- #< ⇒ Boolean
- #<= ⇒ Boolean
- #<=> ⇒ Integer?
-
#==(other) ⇒ Boolean
(also: #eql?)
Compare with another SignedInteger or Integer.
- #> ⇒ Boolean
- #>= ⇒ Boolean
-
#hash ⇒ Integer
Hash code for use in Hash keys.
-
#initialize(value) ⇒ SignedInteger
constructor
Create a new SignedInteger.
-
#inspect ⇒ String
String representation.
- #to_f ⇒ Float
- #to_i ⇒ Integer
- #to_s ⇒ String
-
#value ⇒ Integer
Get the underlying integer value.
Constructor Details
#initialize(value) ⇒ SignedInteger
Create a new SignedInteger
23 24 25 26 27 |
# File 'lib/factorix/ser_des/signed_integer.rb', line 23 def initialize(value) raise ArgumentError, "value must be an Integer" unless value.is_a?(Integer) super end |
Instance Method Details
#% ⇒ Numeric
25 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 25
def %: (Numeric other) -> Numeric
|
#* ⇒ Numeric
23 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 23
def *: (Numeric other) -> Numeric
|
#** ⇒ Numeric
26 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 26
def **: (Numeric other) -> Numeric
|
#+ ⇒ Numeric
Delegated Integer methods
21 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 21
def +: (Numeric other) -> Numeric
|
#- ⇒ Numeric
22 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 22
def -: (Numeric other) -> Numeric
|
#/ ⇒ Numeric
24 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 24
def /: (Numeric other) -> Numeric
|
#< ⇒ Boolean
28 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 28
def <: (Numeric other) -> bool
|
#<= ⇒ Boolean
29 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 29
def <=: (Numeric other) -> bool
|
#<=> ⇒ Integer?
27 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 27
def <=>: (untyped other) -> Integer?
|
#==(other) ⇒ Boolean Also known as: eql?
Compare with another SignedInteger or Integer
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/factorix/ser_des/signed_integer.rb', line 38 def ==(other) case other when SignedInteger value == other.value when Integer value == other else false end end |
#> ⇒ Boolean
30 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 30
def >: (Numeric other) -> bool
|
#>= ⇒ Boolean
31 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 31
def >=: (Numeric other) -> bool
|
#hash ⇒ Integer
Hash code for use in Hash keys
52 |
# File 'lib/factorix/ser_des/signed_integer.rb', line 52 def hash = [value, :signed].hash |
#inspect ⇒ String
String representation
60 |
# File 'lib/factorix/ser_des/signed_integer.rb', line 60 def inspect = "#<Factorix::SerDes::SignedInteger:0x%016x value=#{value}>" % object_id |
#to_f ⇒ Float
34 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 34
def to_f: () -> Float
|
#to_i ⇒ Integer
33 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 33
def to_i: () -> Integer
|
#to_s ⇒ String
32 |
# File 'sig/factorix/ser_des/signed_integer.rbs', line 32
def to_s: () -> String
|
#value ⇒ Integer
Get the underlying integer value
32 |
# File 'lib/factorix/ser_des/signed_integer.rb', line 32 def value = __getobj__ |