Skip to content

Commit

Permalink
Remove :complex option
Browse files Browse the repository at this point in the history
It was only needed for my experimental dirty tracking feature which is
no longer part of Virtus
  • Loading branch information
solnic committed Jul 23, 2011
1 parent ae24bd4 commit 24c24c3
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 35 deletions.
20 changes: 3 additions & 17 deletions lib/virtus/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def self.determine_type_from_string(string)
#
# @example
# Virtus::Attribute::String.options
# # => {:primitive => String, :complex => false}
# # => {:primitive => String}
#
# @return [Hash]
# a hash of default option values
Expand All @@ -98,7 +98,7 @@ def self.options
#
# @example
# Virtus::Attribute::String.accepted_options
# # => [:primitive, :complex, :accessor, :reader, :writer]
# # => [:primitive, :accessor, :reader, :writer]
#
# @return [Array]
# the array of valid option names
Expand Down Expand Up @@ -241,7 +241,7 @@ def self.primitive?(value)

DEFAULT_ACCESSOR = :public

OPTIONS = [ :primitive, :complex, :accessor, :reader, :writer, :typecast_method ].freeze
OPTIONS = [ :primitive, :accessor, :reader, :writer, :typecast_method ].freeze

accept_options *OPTIONS

Expand All @@ -262,24 +262,10 @@ def initialize(name, options = {})

@instance_variable_name = "@#{@name}".freeze
@typecast_method = @options.fetch(:typecast_method)
@complex = @options.fetch(:complex, false)

set_visibility
end

# Returns if an attribute is a complex one
#
# @example
# Virtus::Attribute::String.complex? # => false
# Virtus::Attribute::Array.complex? # => true
#
# @return [Boolean]
#
# @api public
def complex?
@complex
end

# Returns value of an attribute for the given instance
#
# @example
Expand Down
2 changes: 1 addition & 1 deletion lib/virtus/attribute/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Attribute
class Array < Object
primitive ::Array
typecast_method :to_array
complex true

end # class Array
end # class Attribute
end # module Virtus
1 change: 0 additions & 1 deletion lib/virtus/attribute/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Attribute
class Hash < Object
primitive ::Hash
typecast_method :to_hash
complex true

end # class Hash
end # class Attribute
Expand Down
1 change: 0 additions & 1 deletion spec/unit/shared/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
it_behaves_like 'Attribute.primitive?'
it_behaves_like 'Attribute#set'
it_behaves_like 'Attribute#get'
it_behaves_like 'Attribute#complex?'
end
15 changes: 0 additions & 15 deletions spec/unit/shared/attribute/complex.rb

This file was deleted.

0 comments on commit 24c24c3

Please sign in to comment.