Sha256: ef6c2913aba935538df49c6d8f916ab87785c524e6b21a32580fd5d61cf62d4b

Contents?: true

Size: 806 Bytes

Versions: 13

Compression:

Stored size: 806 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 to_s
          namespace.join('::')
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rubrowser-2.9.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.8.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.7.1 lib/rubrowser/parser/definition/base.rb
rubrowser-2.7.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.6.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.5.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.4.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.3.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.2.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.1.0 lib/rubrowser/parser/definition/base.rb
rubrowser-2.0.0 lib/rubrowser/parser/definition/base.rb
rubrowser-0.3.1 lib/rubrowser/parser/definition/base.rb
rubrowser-0.3.0 lib/rubrowser/parser/definition/base.rb