class Yoda::Parsing::Query::CurrentNodeCommentQuery

Attributes

ast[R]
comments[R]
location[R]

Public Class Methods

new(comments, location) click to toggle source

@param ast [::Parser::AST::Node] @param comments [Array<::Parser::Source::Comment>] @param location [Location]

# File lib/yoda/parsing/query/current_node_comment_query.rb, line 10
def initialize(comments, location)
  @ast = ast
  @comments = comments
  @location = location
end

Public Instance Methods

current_commenting_node() click to toggle source

@return [Array<::Parser::Source::Comment>]

# File lib/yoda/parsing/query/current_node_comment_query.rb, line 17
def current_commenting_node
  @current_commenting_node ||= inverse_association[current_comment_block]
end

Private Instance Methods

association() click to toggle source

@return [{::Parser::AST::Node => Array<::Parser::Source::Comment>}]

# File lib/yoda/parsing/query/current_node_comment_query.rb, line 24
def association
  @association ||= ::Parser::Source::Comment.associate(ast, comments)
end
inverse_association() click to toggle source

@return [{Array<::Parser::Source::Comment> => ::Parser::AST::Node}]

# File lib/yoda/parsing/query/current_node_comment_query.rb, line 29
def inverse_association
  @inverse_association ||= association.invert
end
location_association() click to toggle source

@return [{::Parser::Source::Map => Array<::Parser::Source::Comment>]

# File lib/yoda/parsing/query/current_node_comment_query.rb, line 34
def location_association
  @location_association ||= ::Parser::Source::Comment.associate_with_location(ast, comments)
end