Sha256: d2902987fcb8f0d919df61535cfe180e701bba0552febe9f93124c567d3b327b
Contents?: true
Size: 486 Bytes
Versions: 3
Compression:
Stored size: 486 Bytes
Contents
module BabyBots class State attr_reader :state, :table def initialize(state, table={}) @state = state @table = table end def add_transition(event, transition, &callback) @table[event] = transition end # the idea behind build is that you can call multiple # :event :transition and the build method # will parse them out and add them to state def build(*args) args.map {|k,v| add_transition(k, v) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
baby_bots-0.0.3 | lib/baby_bots/state.rb |
baby_bots-0.0.2 | lib/baby_bots/state.rb |
baby_bots-0.0.1 | lib/baby_bots/state.rb |