Sha256: 22d16629e25c6fdef528cec3ff2580f39e59947bbd8ca2d2726c92969380aee9

Contents?: true

Size: 817 Bytes

Versions: 11

Compression:

Stored size: 817 Bytes

Contents

require 'active_support/concern'

module Smithy
  module ContentPieces
    class Registry
      @@content_pieces = []

      class << self
        def clear
          @@content_pieces = []
        end

        def content_pieces
          @@content_pieces
        end

        def register(content_piece)
          content_piece = content_piece.to_sym
          return if @@content_pieces.include?(content_piece)
          @@content_pieces << content_piece
          Smithy::Engine.routes.prepend do
            scope '/smithy/content_pieces' do
              resources content_piece
            end
          end
          @@content_pieces
        end
      end
    end
  end
end

Smithy::Engine.routes.draw do
  namespace :smithy do
    scope "/content_pieces" do
      resources :store_locations
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
smithycms-0.5.1 lib/smithy/content_pieces/registry.rb
smithycms-0.5.0 lib/smithy/content_pieces/registry.rb
smithycms-0.4.5 lib/smithy/content_pieces/registry.rb
smithycms-0.4.4 lib/smithy/content_pieces/registry.rb
smithycms-0.4.3 lib/smithy/content_pieces/registry.rb
smithycms-0.4.2 lib/smithy/content_pieces/registry.rb
smithycms-0.4.1 lib/smithy/content_pieces/registry.rb
smithycms-0.4.0 lib/smithy/content_pieces/registry.rb
smithycms-0.0.3 lib/smithy/content_pieces/registry.rb
smithycms-0.0.2 lib/smithy/content_pieces/registry.rb
smithycms-0.0.1 lib/smithy/content_pieces/registry.rb