Class: MongoModel::Types::Rational

Inherits:
Object
  • Object
show all
Defined in:
lib/mongomodel/support/types/rational.rb

Instance Method Summary collapse

Methods inherited from Object

#boolean, #to_query

Instance Method Details

#cast(value) ⇒ Object


7
8
9
# File 'lib/mongomodel/support/types/rational.rb', line 7

def cast(value)
  Rational(value)
end

#from_mongo(value) ⇒ Object


23
24
25
# File 'lib/mongomodel/support/types/rational.rb', line 23

def from_mongo(value)
  rational_from_string(value)
end

#to_mongo(value) ⇒ Object


27
28
29
# File 'lib/mongomodel/support/types/rational.rb', line 27

def to_mongo(value)
  value.to_s
end