Created
September 22, 2010 00:32
-
-
Save lastk/590874 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Robot | |
def self.attr_state(*names) | |
names.each{|n| | |
n = n.to_sym | |
attr_writer n | |
attr_reader n | |
} | |
end | |
def self.attr_action(*names) | |
names.each{|n| | |
n = n.to_sym | |
define_method(n){|param| @actions[n] = param } | |
} | |
end | |
def self.attr_event(*names) | |
names.each{|n| | |
n = n.to_sym | |
define_method(n){ @events[n] } | |
} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'robot' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment