Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor documentation update

  • Loading branch information...
commit e4cea92dd203427cfe9e45a322e6c2a3becd9d15 1 parent c1cb306
@dkubb dkubb authored
View
4 lib/virtus/attribute.rb
@@ -249,6 +249,8 @@ def self.primitive?(value)
# @param [#to_hash] options
# hash of extra options which overrides defaults set on an attribute class
#
+ # @return [undefined]
+ #
# @api private
def initialize(name, options = {})
@name = name
@@ -292,6 +294,8 @@ def typecast(value)
# Converts the given value to the primitive type
#
+ # @return [Object]
+ #
# @api private
def typecast_to_primitive(value)
value
View
2  lib/virtus/attribute/date_time.rb
@@ -26,6 +26,8 @@ class DateTime < Object
# @see Virtus::Typecast::Time.to_datetime
#
+ # @return [DateTime]
+ #
# @api private
def typecast_to_primitive(value)
Typecast::Time.to_datetime(value)
View
2  lib/virtus/attribute/decimal.rb
@@ -16,6 +16,8 @@ class Decimal < Numeric
# @see Virtus::Typecast::Numeric.to_d
#
+ # @return [BigDecimal]
+ #
# @api private
def typecast_to_primitive(value)
Typecast::Numeric.to_d(value)
View
2  lib/virtus/attribute/float.rb
@@ -25,6 +25,8 @@ class Float < Numeric
# @see Virtus::Typecast::Numeric.to_f
#
+ # @return [Float]
+ #
# @api private
def typecast_to_primitive(value)
Typecast::Numeric.to_f(value)
View
2  lib/virtus/attribute/integer.rb
@@ -22,6 +22,8 @@ class Integer < Numeric
# @see Virtus::Typecast::Numeric.to_i
#
+ # @return [Integer]
+ #
# @api private
def typecast_to_primitive(value)
Typecast::Numeric.to_i(value)
View
2  lib/virtus/attribute/string.rb
@@ -19,6 +19,8 @@ class String < Object
# @see Virtus::Typecast::String.call
#
+ # @return [String]
+ #
# @api private
def typecast_to_primitive(value)
Virtus::Typecast::String.call(value)
View
9 lib/virtus/attribute/time.rb
@@ -16,7 +16,12 @@ class Attribute
#
# # typecasting from a hash
# Post.new(:published_at => {
- # :year => 2011, :month => 6, :day => 9, :hour => 11, :minutes => 8 })
+ # :year => 2011,
+ # :month => 6,
+ # :day => 9,
+ # :hour => 11,
+ # :minutes => 8
+ # })
#
# # typecasting from an object which implements #to_time
# Post.new(:published_at => DateTime.now)
@@ -26,6 +31,8 @@ class Time < Object
# @see Virtus::Typecast::Time.to_time
#
+ # @return [Time]
+ #
# @api private
def typecast_to_primitive(value)
Typecast::Time.to_time(value)
View
5 lib/virtus/class_methods.rb
@@ -49,12 +49,11 @@ def attribute(name, type, options = {})
# attribute :age, Integer
# end
#
- # User.attributes # => { name_attribute, age_attribute }
+ # User.attributes # =>
#
# TODO: implement inspect so the output is not cluttered - solnic
#
- # @return [Hash]
- # an attributes hash indexed by attribute names
+ # @return [AttributeSet]
#
# @api public
def attributes
View
8 lib/virtus/instance_methods.rb
@@ -8,7 +8,7 @@ module InstanceMethods
# @param [#to_hash] attributes
# the attributes hash to be set
#
- # @return [Object]
+ # @return [undefined]
#
# @api private
def initialize(attributes = {})
@@ -79,7 +79,6 @@ def []=(name, value)
# user.attributes # => { :name => 'John', :age => 28 }
#
# @return [Hash]
- # the attributes
#
# @api public
def attributes
@@ -110,7 +109,6 @@ def attributes
# a hash of attribute values to be set on an object
#
# @return [Hash]
- # the attributes
#
# @api public
def attributes=(attributes)
@@ -125,6 +123,8 @@ def attributes=(attributes)
#
# @see Virtus::InstanceMethods#[]
#
+ # @return [Object]
+ #
# @api private
def attribute_get(name)
__send__(name)
@@ -134,6 +134,8 @@ def attribute_get(name)
#
# @see Virtus::InstanceMethods#[]=
#
+ # @return [Object]
+ #
# @api private
def attribute_set(name, value)
__send__("#{name}=", value)
View
6 lib/virtus/typecast/time.rb
@@ -19,7 +19,7 @@ class Time
# Virtus::Typecast::Time.to_time('2011/06/09 12:01')
# # => Thu Jun 09 12:01:00 +0200 2011
#
- # @param [Hash, #to_mash, #to_s] value
+ # @param [#to_hash, #to_s] value
# value to be typecast
#
# @return [Time]
@@ -38,7 +38,7 @@ def self.to_time(value)
# Virtus::Typecast::Time.to_date('2011/06/09')
# # => #<Date: 4911443/2,0,2299161>
#
- # @param [Hash, #to_mash, #to_s] value
+ # @param [#to_hash, #to_s] value
# value to be typecast
#
# @return [Date]
@@ -57,7 +57,7 @@ def self.to_date(value)
# Virtus::Typecast::Time.to_datetime('2011/06/09 12:01')
# # => #<DateTime: 3536239681/1440,0,2299161>
#
- # @param [Hash, #to_mash, #to_s] value
+ # @param [#to_hash, #to_s] value
# value to be typecast
#
# @return [DateTime]
Please sign in to comment.
Something went wrong with that request. Please try again.