Sha256: 66b6dbd2b608f70905d63eeeb5ce594631a51368f77beebb14350571723b5daa

Contents?: true

Size: 980 Bytes

Versions: 4

Compression:

Stored size: 980 Bytes

Contents

module Yoda
  module Model
    module NodeSignatures
      # @abstract
      class Base
        # @return [Typing::NodeInfo]
        attr_reader :node_info

        # @param node_info [Typing::NodeInfo]
        def initialize(node_info)
          @node_info = node_info
        end

        # @return [Range]
        def node_range
          node_info.range
        end

        # @abstract
        # @return [Array<Descriptions::Base>]
        def descriptions
          fail NotImplementedError
        end

        # @return [Array<String, Integer, Integer>]
        def defined_files
          []
        end

        # @return [Descriptions::Base]
        def node_type_description
          Descriptions::NodeDescription.new(node_info.node, node_info.type)
        end

        # @return [Array<Descriptions::Base>]
        def type_descriptions
          node_info.objects.map { |object| Descriptions::ValueDescription.new(object) }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/model/node_signatures/base.rb
yoda-language-server-0.10.0 lib/yoda/model/node_signatures/base.rb
yoda-language-server-0.9.0 lib/yoda/model/node_signatures/base.rb
yoda-language-server-0.8.0 lib/yoda/model/node_signatures/base.rb