Class: Rust::FactorValue
Instance Method Summary
collapse
Constructor Details
#initialize(value, level) ⇒ FactorValue
Returns a new instance of FactorValue.
80
81
82
83
|
# File 'lib/rust/core/types/factor.rb', line 80
def initialize(value, level)
@value = value
@level = level
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
127
128
129
|
# File 'lib/rust/core/types/factor.rb', line 127
def method_missing(method, *args, &block)
@level.method(method).call(*args, &block)
end
|
Instance Method Details
#==(other) ⇒ Object
109
110
111
112
113
114
115
116
117
|
# File 'lib/rust/core/types/factor.rb', line 109
def ==(other)
if other.is_a?(FactorValue)
@value == other.value && @level == other.level
elsif other.is_a?(Integer)
@value == other
elsif other.is_a?(Symbol)
@level == other
end
end
|
#eql?(other) ⇒ Boolean
123
124
125
|
# File 'lib/rust/core/types/factor.rb', line 123
def eql?(other)
return self == other
end
|
119
120
121
|
# File 'lib/rust/core/types/factor.rb', line 119
def hash
@value.hash + @level.hash
end
|
105
106
107
|
# File 'lib/rust/core/types/factor.rb', line 105
def inspect
@level.inspect
end
|
89
90
91
|
# File 'lib/rust/core/types/factor.rb', line 89
def level
@level
end
|
93
94
95
|
# File 'lib/rust/core/types/factor.rb', line 93
def to_i
@value
end
|
101
102
103
|
# File 'lib/rust/core/types/factor.rb', line 101
def to_R
self.to_i
end
|
97
98
99
|
# File 'lib/rust/core/types/factor.rb', line 97
def to_sym
@level
end
|
85
86
87
|
# File 'lib/rust/core/types/factor.rb', line 85
def value
@value
end
|