Skip to content

Instantly share code, notes, and snippets.

@wlangstroth
Created February 8, 2013 04:03
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 wlangstroth/4736517 to your computer and use it in GitHub Desktop.
Save wlangstroth/4736517 to your computer and use it in GitHub Desktop.
Object under test
class Rule
def self.setters(*method_names)
method_names.each do |name|
send :define_method, name do |data|
instance_variable_set "@#{name}".to_sym, data.
end
end
end
setters :trigger
def initialize &block
@trigger = "blank trigger special_sauce"
instance_eval &block
"in a #{@trigger}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment