Class: Radiant::AdminUI::RegionPartials

Inherits:
Object
  • Object
show all
Defined in:
lib/radiant/admin_ui/region_partials.rb

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ RegionPartials

Returns a new instance of RegionPartials.



2
3
4
5
# File 'lib/radiant/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
# File 'lib/radiant/admin_ui/region_partials.rb', line 11

def method_missing(method, *args, &block)
  if block_given?
    @partials[method.to_s] = @template.capture(&block)
    nil
  else
    @partials[method.to_s]
  end
end

Instance Method Details

#[](key) ⇒ Object



7
8
9
# File 'lib/radiant/admin_ui/region_partials.rb', line 7

def [](key)
  @partials[key.to_s]
end