Sha256: 9dec013cad3695e5029dcff8fe400395a0133ef78967cc5de8731c722efec0f5

Contents?: true

Size: 872 Bytes

Versions: 3

Compression:

Stored size: 872 Bytes

Contents

module Rubrowser
  module Parser
    module Definition
      class Base
        attr_reader :namespace, :file, :line, :lines

        def initialize(namespace, file: nil, line: nil, lines: 0)
          @namespace = Array(namespace)
          @file = file
          @line = line
          @lines = lines
          @circular = false
        end

        def name
          namespace.last
        end

        def parent
          new(namespace[0...-1])
        end

        def kernel?
          namespace.empty?
        end

        def circular?
          @circular
        end

        def set_circular
          @circular = true
        end

        def ==(other)
          namespace == other.namespace
        end

        def <=>(other)
          to_s <=> other.to_s
        end

        def to_s
          namespace.join('::')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubrowser-2.11 lib/rubrowser/parser/definition/base.rb
rubrowser-2.10 lib/rubrowser/parser/definition/base.rb
rubrowser-2.9.1 lib/rubrowser/parser/definition/base.rb