Class: Yoda::Parsing::Scopes::ClassDefinition
- Defined in:
- lib/yoda/parsing/scopes/class_definition.rb
Overview
Wrapper class for class node. “‘ (class (const nil :Foo) (const nil :Bar) (nil)) “class Foo < Bar; end”
~~~~~ keyword ~~~ end
~ operator
~~~~~~~~~~~~~~~~~~~~ expression
(class (const nil :Foo) nil (nil)) “class Foo; end”
~~~~~ keyword
~~~ end
~~~~~~~~~~~~~~ expression
“‘
Instance Attribute Summary
Attributes inherited from Base
#child_scopes, #method_definitions, #node, #parent
Instance Method Summary collapse
- #body_node ⇒ Object
- #body_nodes ⇒ Object
- #const_node ⇒ Object
- #kind ⇒ Object
- #scope_name ⇒ String
- #superclass_const_node ⇒ Object
Methods inherited from Base
#ancestor_scopes, #find_evaluation_root_scope, #initialize, #inner_location?, #method?
Constructor Details
This class inherits a constructor from Yoda::Parsing::Scopes::Base
Instance Method Details
#body_node ⇒ Object
32 33 34 |
# File 'lib/yoda/parsing/scopes/class_definition.rb', line 32 def body_node node.children.last end |
#body_nodes ⇒ Object
28 29 30 |
# File 'lib/yoda/parsing/scopes/class_definition.rb', line 28 def body_nodes [body_node] end |
#const_node ⇒ Object
20 21 22 |
# File 'lib/yoda/parsing/scopes/class_definition.rb', line 20 def const_node @const_node ||= NodeObjects::ConstNode.new(node.children[0]) end |
#kind ⇒ Object
36 37 38 |
# File 'lib/yoda/parsing/scopes/class_definition.rb', line 36 def kind :class end |
#scope_name ⇒ String
41 42 43 |
# File 'lib/yoda/parsing/scopes/class_definition.rb', line 41 def scope_name const_node.to_s(parent.scope_name) end |
#superclass_const_node ⇒ Object
24 25 26 |
# File 'lib/yoda/parsing/scopes/class_definition.rb', line 24 def superclass_const_node @superclass_const_node ||= node.children && NodeObjects::ConstNode.new(node.children[1]) end |