Class: Attrio::Types::Float

Inherits:
Base show all
Defined in:
lib/attrio/types/float.rb

Class Method Summary collapse

Methods inherited from Base

default_reader_aliases, default_writer_aliases

Class Method Details

.typecast(value, options = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/attrio/types/float.rb', line 6

def self.typecast(value, options = {})
  begin
    value.to_f
  rescue NoMethodError => e
    nil
  end
end

.typecasted?(value, options = {}) ⇒ Boolean

Returns:



14
15
16
# File 'lib/attrio/types/float.rb', line 14

def self.typecasted?(value, options = {})
  value.is_a? ::Float
end