Class: AppEngine::Datastore::Rating

Inherits:
Object
  • Object
show all
Defined in:
lib/appengine-apis/datastore_types.rb

Overview

A user-provided integer rating for a piece of content. Normalized to a 0-100 scale.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(rating) ⇒ Object

Raises ArgumentError if rating < 0 or rating > 100.



179
180
181
182
183
184
185
# File 'lib/appengine-apis/datastore_types.rb', line 179

def self.new(rating)
  if rating < MIN_VALUE || rating > MAX_VALUE
    raise ArgumentError, "rating must be no smaller than #{MIN_VALUE} " +
        "and no greater than #{MAX_VALUE} (received #{rating})"
  end
  super(rating)
end

Instance Method Details

#inspectObject



193
194
195
# File 'lib/appengine-apis/datastore_types.rb', line 193

def inspect
  "#<Rating #{rating}>"
end

#to_sObject



189
190
191
# File 'lib/appengine-apis/datastore_types.rb', line 189

def to_s
  rating.to_s
end