diff options
| author | Teddy Wing | 2017-09-22 12:25:36 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-09-22 12:25:36 +0200 |
| commit | 404b143af9ed49912e1e0065c832639188aa87de (patch) | |
| tree | 1cb3060bb7bb7d7531818946d423897c0ceff701 /lib/model_attribute.rb | |
| parent | 9179af1df905ff9980228d2aa0ba77418f2781aa (diff) | |
| download | chouette-core-404b143af9ed49912e1e0065c832639188aa87de.tar.bz2 | |
ModelAttribute: Add `.classes` method
This allows people to get a list of the classes defined in
`ModelAttribute`. The classes are turned into constant-cased strings.
Not sure if that's useful, but this is how it was described in the
ticket.
Refs #4401
Diffstat (limited to 'lib/model_attribute.rb')
| -rw-r--r-- | lib/model_attribute.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/model_attribute.rb b/lib/model_attribute.rb index e74dd1060..53c0b7a46 100644 --- a/lib/model_attribute.rb +++ b/lib/model_attribute.rb @@ -9,6 +9,14 @@ class ModelAttribute all << new(klass, name, data_type) end + def self.classes + all + .map(&:klass) + .map(&:to_s) + .map(&:camelize) + .uniq + end + def self.methods_by_class(klass) all.select do |model_attr| model_attr.klass == klass |
