Class: Postscript::Model::Literals::Procedure
- Inherits:
-
Object
- Object
- Postscript::Model::Literals::Procedure
- Includes:
- Enumerable
- Defined in:
- lib/postscript/model/literals/procedure.rb
Overview
Procedure body: { ... }. Carries the inner token stream as a
list of literal/operator nodes. Procedures are not executed by
the parser; the renderer descends into them on InvokeProcedure.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #accept(visitor, ctx) ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(body = []) ⇒ Procedure
constructor
A new instance of Procedure.
- #length ⇒ Object
Constructor Details
#initialize(body = []) ⇒ Procedure
Returns a new instance of Procedure.
14 15 16 17 |
# File 'lib/postscript/model/literals/procedure.rb', line 14 def initialize(body = []) @body = body.freeze freeze end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
12 13 14 |
# File 'lib/postscript/model/literals/procedure.rb', line 12 def body @body end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
30 31 32 |
# File 'lib/postscript/model/literals/procedure.rb', line 30 def ==(other) other.is_a?(Procedure) && other.body == @body end |
#accept(visitor, ctx) ⇒ Object
26 27 28 |
# File 'lib/postscript/model/literals/procedure.rb', line 26 def accept(visitor, ctx) visitor.visit_procedure(self, ctx) end |
#each(&block) ⇒ Object
19 20 21 |
# File 'lib/postscript/model/literals/procedure.rb', line 19 def each(&block) @body.each(&block) end |
#empty? ⇒ Boolean
24 |
# File 'lib/postscript/model/literals/procedure.rb', line 24 def empty? = @body.empty? |
#hash ⇒ Object
35 36 37 |
# File 'lib/postscript/model/literals/procedure.rb', line 35 def hash @body.hash end |
#length ⇒ Object
23 |
# File 'lib/postscript/model/literals/procedure.rb', line 23 def length = @body.length |