Class: TrustyCms::AdminUI::RegionPartials
- Inherits:
-
Object
- Object
- TrustyCms::AdminUI::RegionPartials
show all
- Defined in:
- lib/trusty_cms/admin_ui/region_partials.rb
Instance Method Summary
collapse
Constructor Details
2
3
4
5
|
# File 'lib/trusty_cms/admin_ui/region_partials.rb', line 2
def initialize(template)
@partials = Hash.new {|h,k| h[k] = "<strong>`#{k}' default partial not found!</strong>" }
@template = template
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/trusty_cms/admin_ui/region_partials.rb', line 11
def method_missing(method, *args, &block)
if block_given?
if RUBY_VERSION =~ /^1\.9/ and block.lambda? and block.arity != 1
raise "You can only pass a proc ('Proc.new') or a lambda that takes exactly one arg (for self) to TrustyCms::AdminUI::RegionPartials' method_missing."
end
@partials[method.to_s] = @template.capture(&block)
else
@partials[method.to_s]
end
end
|
Instance Method Details
#[](key) ⇒ Object
7
8
9
|
# File 'lib/trusty_cms/admin_ui/region_partials.rb', line 7
def [](key)
@partials[key.to_s]
end
|