Class: Spektr::Exp::Definition
- Defined in:
- lib/spektr/exp/definition.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#private ⇒ Object
Returns the value of attribute private.
-
#protected ⇒ Object
Returns the value of attribute protected.
Attributes inherited from Base
#arguments, #ast, #body, #location, #name, #options, #type
Instance Method Summary collapse
-
#initialize(ast) ⇒ Definition
constructor
A new instance of Definition.
- #process(ast) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(ast) ⇒ Definition
Returns a new instance of Definition.
6 7 8 9 |
# File 'lib/spektr/exp/definition.rb', line 6 def initialize(ast) super process @ast.children end |
Instance Attribute Details
#private ⇒ Object
Returns the value of attribute private.
4 5 6 |
# File 'lib/spektr/exp/definition.rb', line 4 def private @private end |
#protected ⇒ Object
Returns the value of attribute protected.
4 5 6 |
# File 'lib/spektr/exp/definition.rb', line 4 def protected @protected end |
Instance Method Details
#process(ast) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/spektr/exp/definition.rb', line 11 def process(ast) ast&.each do |node| next unless Parser::AST::Node === node case node.type when :args node.children.each do |argument| @arguments << argument.children.first end when :begin process(node.children) when :lvasgn @body << Lvasign.new(node) when :ivasgn @body << Ivasign.new(node) when :send @body << Send.new(node) end end end |