Class: BEL::Language::F
- Inherits:
-
Object
- Object
- BEL::Language::F
- Defined in:
- lib/bel/language.rb
Instance Attribute Summary collapse
-
#func_return ⇒ Object
readonly
Returns the value of attribute func_return.
-
#var ⇒ Object
readonly
Returns the value of attribute var.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(func_return, var = false) ⇒ F
constructor
A new instance of F.
- #to_s ⇒ Object
Constructor Details
#initialize(func_return, var = false) ⇒ F
Returns a new instance of F.
170 171 172 173 |
# File 'lib/bel/language.rb', line 170 def initialize(func_return, var=false) @func_return = func_return @var = var end |
Instance Attribute Details
#func_return ⇒ Object (readonly)
Returns the value of attribute func_return.
169 170 171 |
# File 'lib/bel/language.rb', line 169 def func_return @func_return end |
#var ⇒ Object (readonly)
Returns the value of attribute var.
169 170 171 |
# File 'lib/bel/language.rb', line 169 def var @var end |
Instance Method Details
#<=>(other) ⇒ Object
187 188 189 190 191 192 193 |
# File 'lib/bel/language.rb', line 187 def <=>(other) return 1 if @var ^ other.var tree = FUNCTION_TYPES[@func_return] return -1 if not tree.include?(other.func_return) -(tree.index(@func_return) <=> tree.index(other.func_return)) end |
#==(other) ⇒ Object Also known as: eql?
175 176 177 178 179 |
# File 'lib/bel/language.rb', line 175 def ==(other) return false if other == nil return false if not other.respond_to? :func_return @func_return == other.func_return and @var == other.var end |
#hash ⇒ Object
183 184 185 |
# File 'lib/bel/language.rb', line 183 def hash [@func_return, @var].hash end |
#to_s ⇒ Object
195 196 197 |
# File 'lib/bel/language.rb', line 195 def to_s "F:#{@func_return}#{'...' if @var}" end |