Skip to content

Instantly share code, notes, and snippets.

wesbailey@feynman:~> irb
ruby-1.9.2-p0 > class NeverWriteCodeLikeThis
ruby-1.9.2-p0 ?> @@actions = ["create", "retrieve", "update"]
ruby-1.9.2-p0 ?>
ruby-1.9.2-p0 > def initialize(val)
ruby-1.9.2-p0 ?> @@actions.each do |m| # ["create", "retrieve", "update"].each do |m|
ruby-1.9.2-p0 > instance_variable_set("@#{m}_process".to_sym, val) # instance_variable_set("@create_process".to_sym, val)
ruby-1.9.2-p0 ?> end # end
ruby-1.9.2-p0 ?> end
ruby-1.9.2-p0 ?> end