Files

Class Index [+]

Quicksearch

Arel::Types

Public Instance Methods

type_cast(value) click to toggle source
     # File lib/arel/algebra/attributes/attribute.rb, line 266
266:       def type_cast(value)
267:         if root == self
268:           raise NotImplementedError, "#type_cast should be implemented in a subclass."
269:         else
270:           root.type_cast(value)
271:         end
272:       end
type_cast_to_numeric(value, method) click to toggle source
     # File lib/arel/algebra/attributes/attribute.rb, line 274
274:       def type_cast_to_numeric(value, method)
275:         return unless value
276:         if value.respond_to?(:to_str)
277:           str = value.to_str.strip
278:           return if str.empty?
279:           return $1.send(method) if str =~ /\A(-?(?:0|[1-9]\d*)(?:\.\d+)?|(?:\.\d+))\z/
280:         elsif value.respond_to?(method)
281:           return value.send(method)
282:         end
283:         raise typecast_error(value)
284:       end
typecast_error(value) click to toggle source
     # File lib/arel/algebra/attributes/attribute.rb, line 286
286:       def typecast_error(value)
287:         raise TypecastError, "could not typecast #{value.inspect} to #{self.class.name.split('::').last}"
288:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.