Class: GameOfThrones

Inherits:
Object
  • Object
show all
Defined in:
lib/game_of_thrones.rb,
lib/game_of_thrones/version.rb

Constant Summary collapse

VERSION =
'0.1.1'

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ GameOfThrones

Returns a new instance of GameOfThrones.



4
5
6
7
8
9
10
11
# File 'lib/game_of_thrones.rb', line 4

def initialize(options)
  @options = {
    :timeout => 10 * 60,
    :cache_key => "GameOfThrones.",
    :cache => "You have to set :cache",
    :mutex_timeout => 0.1
  }.merge(options)
end

Instance Method Details

#rise_to_powerObject



13
14
15
16
17
18
19
20
21
# File 'lib/game_of_thrones.rb', line 13

def rise_to_power
  if no_king? or in_power?
    take_power
    sleep mutex_timeout # multiple people could try to take power simultaneously
    in_power?
  else
    false
  end
end