aboutsummaryrefslogtreecommitdiffstats
path: root/lib/model_attribute.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/model_attribute.rb')
-rw-r--r--lib/model_attribute.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/model_attribute.rb b/lib/model_attribute.rb
index 98bb54b67..8f1ecabed 100644
--- a/lib/model_attribute.rb
+++ b/lib/model_attribute.rb
@@ -9,6 +9,12 @@ class ModelAttribute
all << new(klass, name, data_type)
end
+ def self.methods_by_class(klass)
+ all.select do |model_attr|
+ model_attr.klass == klass.downcase.to_sym
+ end
+ end
+
def initialize(klass, name, data_type)
@klass = klass
@name = name
@@ -59,4 +65,10 @@ class ModelAttribute
def code
"#{@klass}##{@name}"
end
+
+ def ==(other)
+ klass == other.klass &&
+ name == other.name &&
+ data_type == other.data_type
+ end
end