Sha256: baac958e734197848917b4d6071af0bb94cdea7e8659059e63f49cf9fd3d4ab9

Contents?: true

Size: 617 Bytes

Versions: 74

Compression:

Stored size: 617 Bytes

Contents

module Jets
  class Router
    class Scope
      attr_reader :options, :parent, :level
      def initialize(options = {}, parent = nil, level = 1)
        @options = options
        @parent = parent
        @level = level
      end

      def root?
        @parent.nil?
      end

      def new(options={})
        self.class.new(options, self, level + 1)
      end

      def full_namespace
        ns = []
        current = self
        while current
          ns.unshift(current.options[:namespace])
          current = current.parent
        end
        ns.empty? ? nil : ns.join('/')
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 3 rubygems

Version Path
jets-1.6.2 lib/jets/router/scope.rb
jets-1.6.1 lib/jets/router/scope.rb
jets-1.6.0 lib/jets/router/scope.rb
jets-1.5.10 lib/jets/router/scope.rb
jets-1.5.9 lib/jets/router/scope.rb
jets-1.5.8 lib/jets/router/scope.rb
jets-1.5.7 lib/jets/router/scope.rb
jets-1.5.6 lib/jets/router/scope.rb
jets-1.5.5 lib/jets/router/scope.rb
jets-1.5.4 lib/jets/router/scope.rb
jets-1.5.3 lib/jets/router/scope.rb
jets-1.5.2 lib/jets/router/scope.rb
jets-1.5.1 lib/jets/router/scope.rb
jets-1.5.0 lib/jets/router/scope.rb