Skip to content

Commit

Permalink
[#901] support for serialized type on Ruby 1.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlarsen committed Jan 17, 2011
1 parent 2b66101 commit 3076e8e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hobofields/lib/hobo_fields.rb
Expand Up @@ -72,8 +72,10 @@ def can_wrap?(type, val)
col_type = type::COLUMN_TYPE
return false if val.blank? && (col_type == :integer || col_type == :float || col_type == :decimal)
klass = Object.instance_method(:class).bind(val).call # Make sure we get the *real* class
arity = type.instance_method(:initialize).arity
(arity == 1 || arity == -1) && !@never_wrap_types.any? { |c| klass <= c }
init_method = type.instance_method(:initialize)
[-1,1].include?(init_method.arity) &&
init_method.owner != Object.instance_method(:initialize).owner &&
!@never_wrap_types.any? { |c| klass <= c }
end


Expand Down

0 comments on commit 3076e8e

Please sign in to comment.