Class: Referral::TranslatesNodeToToken
- Inherits:
-
Object
- Object
- Referral::TranslatesNodeToToken
- Defined in:
- lib/referral/translates_node_to_token.rb
Instance Method Summary collapse
Instance Method Details
#call(node, parent, file) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/referral/translates_node_to_token.rb', line 6 def call(node, parent, file) return unless (type = TOKEN_TYPES.values.find { |d| node.type == d.ast_type }) Value::Token.new( name: type.name_finder.call(node), node_type: type, parent: parent, file: file, line: node.first_lineno, column: node.first_column, arity: type&.arity_finder&.call(node) ) end |