Skip to content

Commit

Permalink
Deprecate ClassMethods.attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Jun 8, 2012
1 parent 28a01ee commit 68ce27f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class User
end

user = User.new(:name => 'Piotr', :age => 28)
user.attributes # => { :name => "Piotr", :age => 28 }
user.attribute_set # => { :name => "Piotr", :age => 28 }

This comment has been minimized.

Copy link
@dkubb

dkubb Jun 8, 2012

Collaborator

@solnic did you meant to change this example too? I thought the instances still had the #attributes method.

This comment has been minimized.

Copy link
@solnic

solnic Jun 8, 2012

Author Owner

oops thanks! I'll fix in a second


user.name # => "Piotr"

Expand Down
10 changes: 10 additions & 0 deletions lib/virtus/class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ def attribute_set
@attribute_set = AttributeSet.new(parent)
end

# @see Virtus::ClassMethods.attribute_set
#
# @deprecated
#
# @api public
def attributes
warn "#{self}.attributes is deprecated. Use #{self}.attribute_set instead: #{caller.first}"
attribute_set
end

protected

# Set up the anonymous module which will host Attribute accessor methods
Expand Down

0 comments on commit 68ce27f

Please sign in to comment.