class MongoModel::Types::Rational

Public Instance Methods

cast(value) click to toggle source
# File lib/mongomodel/support/types/rational.rb, line 7
def cast(value)
  Rational(value)
end
from_mongo(value) click to toggle source
# File lib/mongomodel/support/types/rational.rb, line 23
def from_mongo(value)
  rational_from_string(value)
end
to_mongo(value) click to toggle source
# File lib/mongomodel/support/types/rational.rb, line 27
def to_mongo(value)
  value.to_s
end

Private Instance Methods

rational_from_string(str) click to toggle source
# File lib/mongomodel/support/types/rational.rb, line 33
def rational_from_string(str)
  Rational(str)
end