Sha256: 439bd8a2f7a1afcbc7b1c631ef108d0d7419b2dcdc4d12d57d3726cdc846cc0e
Contents?: true
Size: 637 Bytes
Versions: 14
Compression:
Stored size: 637 Bytes
Contents
module Stateflow class State attr_accessor :name, :options def initialize(name, &options) @name = name @options = Hash.new instance_eval(&options) if options end def enter(method = nil, &block) @options[:enter] = method.nil? ? block : method end def exit(method = nil, &block) @options[:exit] = method.nil? ? block : method end def execute_action(action, base) action = @options[action.to_sym] case action when Symbol, String base.send(action) when Proc action.call(base) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems