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.
8957 8958 8959 8960 8961 8962 |
# File 'lib/syntax_tree/node.rb', line 8957 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
8955 8956 8957 |
# File 'lib/syntax_tree/node.rb', line 8955 def comments @comments end |
#predicate ⇒ Object (readonly)
- untyped
-
the expression to be checked
8952 8953 8954 |
# File 'lib/syntax_tree/node.rb', line 8952 def predicate @predicate end |
#statement ⇒ Object (readonly)
- untyped
-
the expression to be executed
8949 8950 8951 |
# File 'lib/syntax_tree/node.rb', line 8949 def statement @statement end |
Instance Method Details
#accept(visitor) ⇒ Object
8964 8965 8966 |
# File 'lib/syntax_tree/node.rb', line 8964 def accept(visitor) visitor.visit_unless_mod(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
8968 8969 8970 |
# File 'lib/syntax_tree/node.rb', line 8968 def child_nodes [statement, predicate] end |
#deconstruct_keys(keys) ⇒ Object
8974 8975 8976 8977 8978 8979 8980 8981 |
# File 'lib/syntax_tree/node.rb', line 8974 def deconstruct_keys(keys) { statement: statement, predicate: predicate, location: location, comments: comments } end |
#format(q) ⇒ Object
8983 8984 8985 |
# File 'lib/syntax_tree/node.rb', line 8983 def format(q) ConditionalModFormatter.new("unless", self).format(q) end |