File: subordinate_class.rb

package info (click to toggle)
ruby-celluloid 0.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 848 kB
  • sloc: ruby: 7,579; makefile: 10
file content (19 lines) | stat: -rw-r--r-- 324 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class SubordinateDead < Celluloid::Error; end

class Subordinate
  include Celluloid
  attr_reader :state

  def initialize(state)
    @state = state
  end

  def crack_the_whip
    case @state
    when :idle
      @state = :working
    else
      raise SubordinateDead, "the spec purposely crashed me :("
    end
  end
end