Class: Rubyzen::Declarations::IfStatementDeclaration
- Inherits:
-
Object
- Object
- Rubyzen::Declarations::IfStatementDeclaration
- Includes:
- Providers::ClassNameProvider, Providers::FilePathProvider, Providers::LineNumberProvider, Providers::SourceCodeProvider
- Defined in:
- lib/rubyzen/declarations/if_statement_declaration.rb
Overview
Represents an if / unless statement within a method or class.
Instance Attribute Summary collapse
- #node ⇒ RuboCop::AST::Node readonly
- #parent ⇒ MethodDeclaration, ClassDeclaration readonly
Instance Method Summary collapse
-
#condition_source ⇒ String?
Returns the raw source of the condition expression.
-
#initialize(node, parent) ⇒ IfStatementDeclaration
constructor
A new instance of IfStatementDeclaration.
-
#name ⇒ String
Returns the name of the parent declaration.
Methods included from Providers::SourceCodeProvider
Methods included from Providers::LineNumberProvider
Methods included from Providers::ClassNameProvider
Methods included from Providers::FilePathProvider
Constructor Details
#initialize(node, parent) ⇒ IfStatementDeclaration
Returns a new instance of IfStatementDeclaration.
24 25 26 27 |
# File 'lib/rubyzen/declarations/if_statement_declaration.rb', line 24 def initialize(node, parent) @node = node @parent = parent end |
Instance Attribute Details
#node ⇒ RuboCop::AST::Node (readonly)
17 18 19 |
# File 'lib/rubyzen/declarations/if_statement_declaration.rb', line 17 def node @node end |
#parent ⇒ MethodDeclaration, ClassDeclaration (readonly)
20 21 22 |
# File 'lib/rubyzen/declarations/if_statement_declaration.rb', line 20 def parent @parent end |
Instance Method Details
#condition_source ⇒ String?
Returns the raw source of the condition expression.
32 33 34 |
# File 'lib/rubyzen/declarations/if_statement_declaration.rb', line 32 def condition_source node.condition&.source end |
#name ⇒ String
Returns the name of the parent declaration.
39 40 41 |
# File 'lib/rubyzen/declarations/if_statement_declaration.rb', line 39 def name parent.name end |