Class: Rubyzen::Declarations::ParameterDeclaration
- Inherits:
-
Object
- Object
- Rubyzen::Declarations::ParameterDeclaration
- Defined in:
- lib/rubyzen/declarations/parameter_declaration.rb
Overview
Represents a method parameter.
Instance Attribute Summary collapse
- #node ⇒ RuboCop::AST::Node readonly
- #parent ⇒ MethodDeclaration readonly
Instance Method Summary collapse
-
#default_value ⇒ Object?
Returns the default value if one is defined.
-
#initialize(node, parent) ⇒ ParameterDeclaration
constructor
A new instance of ParameterDeclaration.
-
#name ⇒ Symbol
Returns the parameter name.
Methods included from Providers::ClassNameProvider
Methods included from Providers::LineNumberProvider
Methods included from Providers::FilePathProvider
Constructor Details
#initialize(node, parent) ⇒ ParameterDeclaration
Returns a new instance of ParameterDeclaration.
23 24 25 26 |
# File 'lib/rubyzen/declarations/parameter_declaration.rb', line 23 def initialize(node, parent) @node = node @parent = parent end |
Instance Attribute Details
#node ⇒ RuboCop::AST::Node (readonly)
16 17 18 |
# File 'lib/rubyzen/declarations/parameter_declaration.rb', line 16 def node @node end |
#parent ⇒ MethodDeclaration (readonly)
19 20 21 |
# File 'lib/rubyzen/declarations/parameter_declaration.rb', line 19 def parent @parent end |
Instance Method Details
#default_value ⇒ Object?
Returns the default value if one is defined.
38 39 40 |
# File 'lib/rubyzen/declarations/parameter_declaration.rb', line 38 def default_value node.children[1]&.value end |
#name ⇒ Symbol
Returns the parameter name.
31 32 33 |
# File 'lib/rubyzen/declarations/parameter_declaration.rb', line 31 def name node.name end |