Class: Yoda::Parsing::Query::CurrentLocationQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/parsing/query/current_location_node_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ast, location) ⇒ CurrentLocationQuery

Returns a new instance of CurrentLocationQuery.

Parameters:

  • ast (::Parser::AST::Node)
  • location (Location)


9
10
11
12
# File 'lib/yoda/parsing/query/current_location_node_query.rb', line 9

def initialize(ast, location)
  @ast = ast
  @location = location
end

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



5
6
7
# File 'lib/yoda/parsing/query/current_location_node_query.rb', line 5

def ast
  @ast
end

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/yoda/parsing/query/current_location_node_query.rb', line 5

def location
  @location
end

Instance Method Details

#current_method_definitionNodeObjects::MethodDefition?

Returns:

  • (NodeObjects::MethodDefition, nil)


20
21
22
# File 'lib/yoda/parsing/query/current_location_node_query.rb', line 20

def current_method_definition
  @current_method_definition ||= namespace.calc_current_location_method(location)
end

#current_namespaceNodeObjects::Namespace?

Returns:



15
16
17
# File 'lib/yoda/parsing/query/current_location_node_query.rb', line 15

def current_namespace
  @current_namespace ||= namespace.calc_current_location_namespace(location)
end