lib/has_eav.rb
def cast_eav_value value, attribute # :nodoc:
          attributes = self.class_eav_attributes.stringify_keys
          return value unless attributes.keys.include?(attribute)
          return value if attributes[attribute] == String # no need for casting

          begin
            # for core types [eg: Integer '12']
            eval("#{attributes[attribute]} '#{value}'")

          rescue
            begin
              attributes[attribute].parse(value)
            rescue
              begin
                attributes[attribute].new(value)
              rescue
                value
              end
            end
          end
        end
# cast an eav value to it's desired class
cast an eav value to it's desired class
cast an eav value to it ' s desired class
def cast_eav_value value, attribute 
          attributes = self.class_eav_attributes.stringify_keys
          return value unless attributes.keys.include?(attribute)
          return value if attributes[attribute] == String 
          begin
            eval("#{attributes[attribute]} '#{value}'")
          rescue
            begin
              attributes[attribute].parse(value)
            rescue
              begin
                attributes[attribute].new(value)
              rescue
                value
              end
            end
          end
        end
def cast_eav_value value , attribute attributes = self . class_eav_attributes . stringify_keys return value unless attributes . keys . include? ( attribute ) return value if attributes [ attribute ] == String begin eval ( "#{attributes[attribute]} '#{value}'" ) rescue begin attributes [ attribute ] . parse ( value ) rescue begin attributes [ attribute ] . new ( value ) rescue value end end end end
cast an eav value to it's desired class
cast an eav value to it ' s desired class
# :nodoc: # no need for casting # for core types [eg: Integer '12']
value
attribute