Sha256: 0c3e3035b7474d5a5027959f37e4e7c33c66ca4df6d935063796c61c8a951653

Contents?: true

Size: 453 Bytes

Versions: 3

Compression:

Stored size: 453 Bytes

Contents

module Administrate
  class Namespace
    class Resource
      attr_reader :namespace, :resource

      def initialize(namespace, resource)
        @namespace = namespace
        @resource = resource
      end

      def to_s
        name.to_s
      end

      def to_sym
        name
      end

      def name
        resource.to_s.gsub(/^#{namespace}\//, "").to_sym
      end

      def path
        name.to_s.tr("/", "_")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
administrate-1.0.0.beta3 lib/administrate/namespace/resource.rb
administrate-1.0.0.beta2 lib/administrate/namespace/resource.rb
administrate-1.0.0.beta1 lib/administrate/namespace/resource.rb