Module: Naming::Viewable::Block

Defined in:
app/models/naming/viewable/block.rb

Class Method Summary collapse

Class Method Details

.namesObject



15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/naming/viewable/block.rb', line 15

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

.restricted_namesObject



5
6
7
8
9
10
11
12
13
# File 'app/models/naming/viewable/block.rb', line 5

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