Sha256: 7cd6fe66690f786de444f7fa5e692b555eb2a77d6902cf458dbb2b2857d5a59b

Contents?: true

Size: 808 Bytes

Versions: 7

Compression:

Stored size: 808 Bytes

Contents

module Naming
  module Viewable
    module Block
      class << self
        def restricted_names
          @_restricted_names ||= Naming::Viewable.names + begin
            CMS.constants.grep(/Helper$/).map{ |name|
              "CMS::#{name}".constantize.instance_methods.grep(/^cms_/)
            }.flatten.map{ |name|
              name.to_s.sub(/^cms_/, '')
            }
          end
        end

        def names
          @_names ||= begin
            names = CMS.html_names 'app/views/cms/blocks'
            names.each do |name|
              if name.in? restricted_names
                raise ArgumentError, "'cms/blocks/_#{name}.html' partial should be called otherwise, '#{name}' taken"
              end
            end
            names
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_admin_cms-0.1.1 app/models/naming/viewable/block.rb
rails_admin_cms-0.0.9 app/models/naming/viewable/block.rb
rails_admin_cms-0.0.7 app/models/naming/viewable/block.rb
rails_admin_cms-0.0.6 app/models/naming/viewable/block.rb
rails_admin_cms-0.0.5 app/models/naming/viewable/block.rb
rails_admin_cms-0.0.4 app/models/naming/viewable/block.rb
rails_admin_cms-0.0.3 app/models/naming/viewable/block.rb