lib/virtus/value_object.rb
# Define an attribute on the receiver
#
# The Attribute will have private writer methods (eg., immutable instances)
#   and be used in equality/equivalence comparisons
#
# @example
#   class GeoLocation
#     include Virtus::ValueObject
#
#     attribute :latitude,  Float
#     attribute :longitude, Float
#   end
#
# @see Virtus::ClassMethods.attribute
#
# @return [self]
#
# @api public
Define an attribute on the receiver
The Attribute will have private writer methods
and be used in equality/equivalence comparisons
Define an attribute on the receiver The Attribute will have private writer methods and be used in equality / equivalence comparisons
def attribute(name, *args)
        equalizer << name
        options = args.last.kind_of?(Hash) ? args.pop : {}
        super name, *args << options.merge(:writer => :private)
      end
def attribute ( name , * args ) equalizer << name options = args . last . kind_of? ( Hash ) ? args . pop : { } super name , * args << options . merge ( :writer => :private ) end
Define an attribute on the receiver
The Attribute will have private writer methods (eg., immutable instances)
and be used in equality/equivalence comparisons
Define an attribute on the receiver The Attribute will have private writer methods ( eg . immutable instances ) and be used in equality / equivalence comparisons
None
self
name
<not_specific>
args
<not_specific>
example
class GeoLocation include Virtus::ValueObject attribute :latitude, Float attribute :longitude, Float end
class GeoLocation include Virtus :: ValueObject attribute : latitude Float attribute : longitude Float end
see
None
api
None