Class: Nydp::Literal
- Inherits:
-
Object
- Object
- Nydp::Literal
- Defined in:
- lib/nydp/literal.rb
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
Class Method Summary collapse
Instance Method Summary collapse
- #<(other) ⇒ Object
- #==(other) ⇒ Object
- #>(other) ⇒ Object
- #coerce(_) ⇒ Object
- #execute(vm) ⇒ Object
-
#initialize(expression) ⇒ Literal
constructor
A new instance of Literal.
- #inspect ⇒ Object
- #lisp_apply ⇒ Object
- #nydp_type ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(expression) ⇒ Literal
Returns a new instance of Literal.
5 6 7 |
# File 'lib/nydp/literal.rb', line 5 def initialize expression @expression = expression end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
3 4 5 |
# File 'lib/nydp/literal.rb', line 3 def expression @expression end |
Class Method Details
.build(expression, bindings) ⇒ Object
13 14 15 |
# File 'lib/nydp/literal.rb', line 13 def self.build expression, bindings new expression end |
Instance Method Details
#<(other) ⇒ Object
33 34 35 |
# File 'lib/nydp/literal.rb', line 33 def < other other > expression end |
#==(other) ⇒ Object
37 38 39 |
# File 'lib/nydp/literal.rb', line 37 def == other other.is_a?(Literal) && (self.expression == other.expression) end |
#>(other) ⇒ Object
29 30 31 |
# File 'lib/nydp/literal.rb', line 29 def > other other < expression end |
#coerce(_) ⇒ Object
25 26 27 |
# File 'lib/nydp/literal.rb', line 25 def coerce _ [_, expression] end |
#execute(vm) ⇒ Object
17 18 19 |
# File 'lib/nydp/literal.rb', line 17 def execute vm vm.push_arg expression end |
#inspect ⇒ Object
22 |
# File 'lib/nydp/literal.rb', line 22 def inspect ; @expression.inspect ; end |
#lisp_apply ⇒ Object
9 10 11 |
# File 'lib/nydp/literal.rb', line 9 def lisp_apply expression end |
#nydp_type ⇒ Object
21 |
# File 'lib/nydp/literal.rb', line 21 def nydp_type ; :literal ; end |
#to_s ⇒ Object
23 |
# File 'lib/nydp/literal.rb', line 23 def to_s ; @expression.to_s ; end |