Module: SBSM::ViralState
- Defined in:
- lib/sbsm/viralstate.rb
Constant Summary collapse
- VIRAL =
true
Instance Method Summary collapse
Instance Method Details
#infect(newstate) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/sbsm/viralstate.rb', line 31 def infect(newstate) @viral_modules.uniq.each { |mod| newstate.extend(mod) unless newstate.is_a?(mod) } newstate end |
#trigger(event) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/sbsm/viralstate.rb', line 37 def trigger(event) newstate = super if(event==:logout) @session.logout else infect(newstate) end newstate rescue RangeError @session.logout home end |