Class: CanTango::Configuration::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/cantango/configuration/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultObject



49
50
51
# File 'lib/cantango/configuration/registry.rb', line 49

def default
  @default ||= []
end

#registeredObject

Returns the value of attribute registered.



9
10
11
# File 'lib/cantango/configuration/registry.rb', line 9

def registered
  @registered
end

Instance Method Details

#[](index) ⇒ Object



37
38
39
# File 'lib/cantango/configuration/registry.rb', line 37

def [] index
  registered[index]
end

#clean!Object Also known as: clear!



20
21
22
# File 'lib/cantango/configuration/registry.rb', line 20

def clean!
  @registered = []
end

#default!Object



26
27
28
# File 'lib/cantango/configuration/registry.rb', line 26

def default!
  @registered = default
end

#register(*list) ⇒ Object Also known as: <<



30
31
32
33
# File 'lib/cantango/configuration/registry.rb', line 30

def register *list
  registered << list.select_kinds_of(*types)
  registered.flat_uniq!
end

#registered?(label) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/cantango/configuration/registry.rb', line 45

def registered? label
  registered.map(&:to_s).include? label.to_s
end

#typesObject



15
16
17
18
# File 'lib/cantango/configuration/registry.rb', line 15

def types
  @types ||= [Symbol, String]
  @types
end

#types=(*types) ⇒ Object



11
12
13
# File 'lib/cantango/configuration/registry.rb', line 11

def types= *types
  @types = types.select {|t| t.is_a? Class }
end