Class: CanTango::Configuration::Models
- Inherits:
-
Object
- Object
- CanTango::Configuration::Models
show all
- Includes:
- Helpers::Debug, ClassExt, Singleton
- Defined in:
- lib/cantango/configuration/models.rb,
lib/cantango/configuration/models/mongo.rb,
lib/cantango/configuration/models/actions.rb,
lib/cantango/configuration/models/generic.rb,
lib/cantango/configuration/models/mongoid.rb,
lib/cantango/configuration/models/data_mapper.rb,
lib/cantango/configuration/models/mongo_mapper.rb,
lib/cantango/configuration/models/active_record.rb
Defined Under Namespace
Classes: Actions, ActiveRecord, DataMapper, Generic, Mongo, MongoMapper, Mongoid
Instance Method Summary
collapse
Instance Method Details
#actions ⇒ Object
11
12
13
|
# File 'lib/cantango/configuration/models.rb', line 11
def actions
@actions ||= Registry::Hash.new
end
|
#available_models ⇒ Object
37
38
39
|
# File 'lib/cantango/configuration/models.rb', line 37
def available_models
all_models - excluded.map {|m| m.to_s.camelize}
end
|
#by_category(label) ⇒ Object
23
24
25
26
27
|
# File 'lib/cantango/configuration/models.rb', line 23
def by_category label
categories[label].map do |model|
model.class == String ? try_model(model) : model
end
end
|
#by_reg_exp(reg_exp) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/cantango/configuration/models.rb', line 15
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
|
#exclude(*names) ⇒ Object
29
30
31
|
# File 'lib/cantango/configuration/models.rb', line 29
def exclude *names
@excluded = names.flatten.select_labels
end
|
#excluded ⇒ Object
33
34
35
|
# File 'lib/cantango/configuration/models.rb', line 33
def excluded
@excluded ||= []
end
|