Skip to content

Instantly share code, notes, and snippets.

@wlangstroth
Created February 8, 2013 04:03
Show Gist options
  • 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