increment_counts(metric, by=1) case metric when :sent @account.increment_sent_count(by) when :viewed @account.increment_viewed_count(by) when :bounced @account.increment_bounced_count(by) end end end
@store.respond_to?(method_name) @store.send(method_name, *args, &block) else super end end ! def respond_to_missing?(method_name, include_private) @store.respond_to?(method_name) || super end end
end end end ! module InstanceMethods def method_missing(*args, &block) method_name = args[0] if method_name && method_name =~ /allowed_to_.*\?/ false else super end end end ! def self.included(receiver) receiver.extend ClassMethods receiver.send :include, InstanceMethods end end