Class: Turntabler::Vote

Inherits:
Resource show all
Defined in:
lib/turntabler/vote.rb

Overview

Represents a vote that was made within a room

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Method Summary

Methods inherited from Resource

#==, attribute, #attributes=, #hash, #initialize, #load, #loaded?, #pretty_print, #pretty_print_instance_variables

Methods included from Assertions

#assert_valid_keys, #assert_valid_values

Methods included from DigestHelpers

#digest

Constructor Details

This class inherits a constructor from Turntabler::Resource

Instance Attribute Details

#directionSymbol (readonly)

Whether the user voted :up or :down

Returns:

  • (Symbol)


15
16
17
# File 'lib/turntabler/vote.rb', line 15

attribute :direction do |value|
  value.to_sym
end

#userTurntabler::User (readonly)

The user who cast the vote

Returns:



9
10
11
# File 'lib/turntabler/vote.rb', line 9

attribute :user, :userid do |value|
  room? ? room.build_user(:_id => value) : User.new(client, :_id => value)
end