Skip to content

Instantly share code, notes, and snippets.

@wlangstroth wlangstroth/rule.rb
Created Feb 8, 2013

Embed
What would you like to do?
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
You can’t perform that action at this time.