Class: SyntaxTree::UnlessMod
Overview
UnlessMod represents the modifier form of an unless statement.
expression unless predicate
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#predicate ⇒ Object
readonly
- untyped
-
the expression to be checked.
-
#statement ⇒ Object
readonly
- untyped
-
the expression to be executed.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(statement:, predicate:, location:, comments: []) ⇒ UnlessMod
constructor
A new instance of UnlessMod.
Methods inherited from Node
Constructor Details
#initialize(statement:, predicate:, location:, comments: []) ⇒ UnlessMod
Returns a new instance of UnlessMod.
8396 8397 8398 8399 8400 8401 |
# File 'lib/syntax_tree/node.rb', line 8396 def initialize(statement:, predicate:, location:, comments: []) @statement = statement @predicate = predicate @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
8394 8395 8396 |
# File 'lib/syntax_tree/node.rb', line 8394 def comments @comments end |
#predicate ⇒ Object (readonly)
- untyped
-
the expression to be checked
8391 8392 8393 |
# File 'lib/syntax_tree/node.rb', line 8391 def predicate @predicate end |
#statement ⇒ Object (readonly)
- untyped
-
the expression to be executed
8388 8389 8390 |
# File 'lib/syntax_tree/node.rb', line 8388 def statement @statement end |
Instance Method Details
#accept(visitor) ⇒ Object
8403 8404 8405 |
# File 'lib/syntax_tree/node.rb', line 8403 def accept(visitor) visitor.visit_unless_mod(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
8407 8408 8409 |
# File 'lib/syntax_tree/node.rb', line 8407 def child_nodes [statement, predicate] end |
#deconstruct_keys(keys) ⇒ Object
8413 8414 8415 8416 8417 8418 8419 8420 |
# File 'lib/syntax_tree/node.rb', line 8413 def deconstruct_keys(keys) { statement: statement, predicate: predicate, location: location, comments: comments } end |
#format(q) ⇒ Object
8422 8423 8424 |
# File 'lib/syntax_tree/node.rb', line 8422 def format(q) ConditionalModFormatter.new("unless", self).format(q) end |