Sha256: 3998375eb815701bc9cdc9b7377428ecfcb5c52b8e71b0fc38a3f75e0941e3b9
Contents?: true
Size: 1.69 KB
Versions: 5
Compression:
Stored size: 1.69 KB
Contents
require 'inch/language/elixir/provider/reader/object/function_parameter_object' module Inch module Language module Elixir module Provider module Reader module Object # Proxy class for functions class FunctionObject < Base def name @hash['id'] end def fullname @hash['module_id'] + '.' + @hash['id'] end def method? true end def parameters names = FunctionSignature.new(@hash['signature']).parameter_names names.map do |name| FunctionParameterObject.new(self, name) end end private class FunctionSignature < Struct.new(:signature) def parameter_names return [] if signature.nil? signature.map do |tuple| name_from_tuple(*tuple) end end def name_from_tuple(a, _, b) if b.nil? || b == 'Elixir' a else if a == '\\\\' candidate = b.first if candidate.is_a?(Array) name_from_tuple(*candidate) else candidate end else warn "[WARN] could not parse FunctionSignature: #{[a, _, b].inspect}" end end end end end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems