aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-08-04 16:28:44 -0500
committerJoshua Peek <josh@joshpeek.com>2009-08-04 16:28:44 -0500
commit64eecdd131c93d7d6c8ef9c6a7ae6b9d76c72a8b (patch)
tree42af333ee4d2812d28ee98ba64d43c0d1971c87b /activerecord/lib/active_record/attribute_methods.rb
parentbada18dc36e3875dea1814ffaab1e8d1ac24b521 (diff)
downloadrails-64eecdd131c93d7d6c8ef9c6a7ae6b9d76c72a8b.tar.gz
rails-64eecdd131c93d7d6c8ef9c6a7ae6b9d76c72a8b.tar.bz2
rails-64eecdd131c93d7d6c8ef9c6a7ae6b9d76c72a8b.zip
whitespace
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 89a92cd7f7..be275f5cb6 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -6,7 +6,7 @@ module ActiveRecord
class AttributeMethodMatcher
attr_reader :prefix, :suffix
-
+
AttributeMethodMatch = Struct.new(:prefix, :base, :suffix)
def initialize(options = {})
@@ -121,11 +121,11 @@ module ActiveRecord
attribute_method_matchers.concat(affixes.map { |affix| AttributeMethodMatcher.new :prefix => affix[:prefix], :suffix => affix[:suffix] })
undefine_attribute_methods
end
-
+
def matching_attribute_methods(method_name)
attribute_method_matchers.collect { |method| method.match(method_name) }.compact
end
-
+
# Defines an "attribute" method (like +inheritance_column+ or
# +table_name+). A new (class) method will be created with the
# given name. If a value is specified, the new method will
@@ -173,7 +173,7 @@ module ActiveRecord
method_name = "#{method.prefix}#{name}#{method.suffix}"
unless instance_method_already_implemented?(method_name)
generate_method = "define_method_#{method.prefix}attribute#{method.suffix}"
-
+
if respond_to?(generate_method)
send(generate_method, name)
else
@@ -215,7 +215,7 @@ module ActiveRecord
match.base == 'id' || @attributes.include?(match.base)
end
end
-
+
# Allows access to the object attributes, which are held in the <tt>@attributes</tt> hash, as though they
# were first-class methods. So a Person class with a name attribute can use Person#name and
# Person#name= and never directly use the attributes hash -- except for multiple assigns with