Module: ViewSlots

Defined in:
lib/view_slots.rb,
lib/view_slots/slot.rb,
lib/view_slots/helper.rb,
lib/view_slots/namespace.rb

Defined Under Namespace

Modules: Helper Classes: Namespace, Slot

Class Method Summary collapse

Class Method Details

.add(slot, name, template, options = {}) ⇒ Object



17
18
19
20
# File 'lib/view_slots.rb', line 17

def self.add(slot, name, template, options={})
  view_slots[slot] ||= ::ViewSlots::Slot.new
  view_slots[slot].add(name, template, options)
end

.find(slot) ⇒ Object



26
27
28
# File 'lib/view_slots.rb', line 26

def self.find(slot)
  view_slots[slot]
end

.method_missing(m, *args) {|namespace| ... } ⇒ Object

Yields:

  • (namespace)


11
12
13
14
15
# File 'lib/view_slots.rb', line 11

def self.method_missing(m, *args)
  namespace = ::ViewSlots::Namespace.new(m)
  yield(namespace) if block_given?
  namespace
end

.remove(slot, name) ⇒ Object



22
23
24
# File 'lib/view_slots.rb', line 22

def self.remove(slot, name)
  view_slots[slot].remove(name) if view_slots[slot]
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (ViewSlots)

    the object that the method was called on



7
8
9
# File 'lib/view_slots.rb', line 7

def self.setup
  yield self
end