Class: Konfig::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/konfig/adapter.rb

Overview

All adapters are subclassed from Konfig::Adapter

Direct Known Subclasses

AssetExpansionAdapter, SmtpAdapter

Class Method Summary collapse

Class Method Details

.childrenArray

Get all child classes

Returns:

  • (Array)

    an array of child classes



15
16
17
# File 'lib/konfig/adapter.rb', line 15

def children
  @children ||= []
end

.clear_childrenObject

Remove child classes from registry



20
21
22
# File 'lib/konfig/adapter.rb', line 20

def clear_children
  @children = []
end

.create_and_send_to_children(*args) ⇒ Object

Instanciates all child classes and envokes a method via obj.send



32
33
34
# File 'lib/konfig/adapter.rb', line 32

def create_and_send_to_children(*args)
  children.each { |c| c.new.send(*args) }
end

.inherited(child_class) ⇒ Object



9
10
11
# File 'lib/konfig/adapter.rb', line 9

def inherited(child_class)
  children << child_class
end

.send_to_children(*args) ⇒ Object

Evokes the send method on all child classes, and passes the args along



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

def send_to_children(*args)
  children.each { |c| c.send(*args) }
end