Class: Rubyzen::Declarations::BlockDeclaration
- Inherits:
-
Object
- Object
- Rubyzen::Declarations::BlockDeclaration
- Includes:
- Providers::CallSiteProvider, Providers::ClassNameProvider, Providers::FilePathProvider, Providers::LineNumberProvider, Providers::LinesOfCodeProvider, Providers::RaisesProvider, Providers::RescuesProvider, Providers::SourceCodeProvider
- Defined in:
- lib/rubyzen/declarations/block_declaration.rb
Overview
Represents a Ruby block (do...end or { }).
Instance Attribute Summary collapse
- #node ⇒ RuboCop::AST::Node readonly
- #parent ⇒ MethodDeclaration, FileDeclaration readonly
Instance Method Summary collapse
-
#initialize(node, parent) ⇒ BlockDeclaration
constructor
A new instance of BlockDeclaration.
-
#method_name ⇒ String
Returns the method name the block is passed to.
-
#name ⇒ String
Returns the method name the block is passed to.
Methods included from Providers::CallSiteProvider
Methods included from Providers::SourceCodeProvider
Methods included from Providers::RaisesProvider
Methods included from Providers::RescuesProvider
Methods included from Providers::LinesOfCodeProvider
Methods included from Providers::ClassNameProvider
Methods included from Providers::LineNumberProvider
Methods included from Providers::FilePathProvider
Constructor Details
#initialize(node, parent) ⇒ BlockDeclaration
Returns a new instance of BlockDeclaration.
29 30 31 32 |
# File 'lib/rubyzen/declarations/block_declaration.rb', line 29 def initialize(node, parent) @node = node @parent = parent end |
Instance Attribute Details
#node ⇒ RuboCop::AST::Node (readonly)
22 23 24 |
# File 'lib/rubyzen/declarations/block_declaration.rb', line 22 def node @node end |
#parent ⇒ MethodDeclaration, FileDeclaration (readonly)
25 26 27 |
# File 'lib/rubyzen/declarations/block_declaration.rb', line 25 def parent @parent end |
Instance Method Details
#method_name ⇒ String
Returns the method name the block is passed to.
44 45 46 |
# File 'lib/rubyzen/declarations/block_declaration.rb', line 44 def method_name node.method_name.to_s end |
#name ⇒ String
Returns the method name the block is passed to. Alias for #method_name.
37 38 39 |
# File 'lib/rubyzen/declarations/block_declaration.rb', line 37 def name method_name end |