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

- (Object) cast(value)



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

def cast(value)
  Rational(value)
end

- (Object) from_mongo(value)



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

def from_mongo(value)
  rational_from_string(value)
end

- (Object) to_mongo(value)



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

def to_mongo(value)
  value.to_s
end