Permalink
Browse files

Add missing docs

  • Loading branch information...
1 parent 9f44d8f commit 23a8b736dcae250f96606dad9e224dcf5b7b9ed9 @solnic committed Jul 31, 2011
Showing with 22 additions and 1 deletion.
  1. +8 −0 lib/virtus/attribute/default_value.rb
  2. +14 −1 lib/virtus/instance_methods.rb
@@ -6,9 +6,17 @@ class DefaultValue
DUP_CLASSES = [ ::NilClass, ::TrueClass, ::FalseClass,
::Numeric, ::Symbol ].freeze
+ # Returns the attribute associated with this default value instance
+ #
+ # @return [Virtus::Attribute::Object]
+ #
# @api private
attr_reader :attribute
+ # Returns the value instance
+ #
+ # @return [Object]
+ #
# @api private
attr_reader :value
@@ -117,7 +117,20 @@ def attributes=(attributes)
end
end
- # @see Virtus::InstanceMethods#attributes
+ # Returns a hash of all publicly accessible attributes
+ #
+ # @example
+ # class User
+ # include Virtus
+ #
+ # attribute :name, String
+ # attribute :age, Integer
+ # end
+ #
+ # user = User.new(:name => 'John', :age => 28)
+ # user.attributes # => { :name => 'John', :age => 28 }
+ #
+ # @return [Hash]
#
# @api public
def to_hash

0 comments on commit 23a8b73

Please sign in to comment.