Class: Referral::TokenizesIdentifiers
- Inherits:
-
Object
- Object
- Referral::TokenizesIdentifiers
- Defined in:
- lib/referral/tokenizes_identifiers.rb
Instance Method Summary collapse
- #call(root_node, root_token) ⇒ Object
-
#initialize ⇒ TokenizesIdentifiers
constructor
A new instance of TokenizesIdentifiers.
Constructor Details
#initialize ⇒ TokenizesIdentifiers
Returns a new instance of TokenizesIdentifiers.
5 6 7 |
# File 'lib/referral/tokenizes_identifiers.rb', line 5 def initialize @translates_node_to_token = TranslatesNodeToToken.new end |
Instance Method Details
#call(root_node, root_token) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/referral/tokenizes_identifiers.rb', line 9 def call(root_node, root_token) find_names(root_node, root_token) .reject { |identifier_token| identifier_token.name.nil? } .tap do |identifiers| root_token.identifiers = identifiers if identifiers.any? { |id| id.node_type == TOKEN_TYPES[:triple_colon] } root_token.parent = nil end end end |