Module: Alephant::Publisher::Views
- Defined in:
- lib/alephant/publisher/views.rb,
lib/alephant/publisher/views/base.rb,
lib/alephant/publisher/views/html.rb,
lib/alephant/publisher/views/json.rb
Defined Under Namespace
Modules: Base
Classes: Html, Json
Constant Summary
collapse
- @@views =
{}
Class Method Summary
collapse
Class Method Details
.get_registered_class(id) ⇒ Object
10
11
12
|
# File 'lib/alephant/publisher/views.rb', line 10
def self.get_registered_class(id)
@@views[id]
end
|
.register(klass) ⇒ Object
6
7
8
|
# File 'lib/alephant/publisher/views.rb', line 6
def self.register(klass)
@@views[underscorify(klass.name.split('::').last)] = klass
end
|
.underscorify(str) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/alephant/publisher/views.rb', line 14
def self.underscorify(str)
str.gsub(/::/, '/').
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
tr("-", "_").
downcase
end
|