Skip to content

Instantly share code, notes, and snippets.

@lastk
Created September 22, 2010 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lastk/590874 to your computer and use it in GitHub Desktop.
Save lastk/590874 to your computer and use it in GitHub Desktop.
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
require 'robot'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment