Class: CanTango::Configuration::Models

Inherits:
Object
  • Object
show all
Includes:
ClassExt, Singleton
Defined in:
lib/cantango/configuration/models.rb

Instance Method Summary collapse

Instance Method Details

#by_category(label) ⇒ Object



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

def by_category label
  categories[label].map do |model|
    model.class == String ? try_model(model) : model
  end
end

#by_reg_exp(reg_exp) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/cantango/configuration/models.rb', line 7

def by_reg_exp reg_exp
  raise "Must be a Regular Expression like: /xyz/ was #{reg_exp.inspect}" if !reg_exp.kind_of? Regexp

  grep(reg_exp).map do |model_string|
    try_model(model_string)
  end
end