Sha256: a79403d733f6b967701afe2e01cb04f05572929c1630783e8de81eb83dd594bc

Contents?: true

Size: 615 Bytes

Versions: 7

Compression:

Stored size: 615 Bytes

Contents

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

        def initialize(namespace, file: nil, line: nil)
          @namespace = Array(namespace)
          @file = file
          @line = line
        end

        def name
          namespace.last
        end

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

        def kernel?
          namespace.empty?
        end

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubrowser-0.2.6 lib/rubrowser/parser/definition/base.rb
rubrowser-0.2.5 lib/rubrowser/parser/definition/base.rb
rubrowser-0.2.4 lib/rubrowser/parser/definition/base.rb
rubrowser-0.2.3 lib/rubrowser/parser/definition/base.rb
rubrowser-0.2.2 lib/parser/definition/base.rb
rubrowser-0.2.1 lib/parser/definition/base.rb
rubrowser-0.2.0 lib/parser/definition/base.rb