Module: Tapper::ClassMethods
- Defined in:
- lib/tapper.rb
Instance Method Summary collapse
Instance Method Details
#method_added(name) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/tapper.rb', line 9 def method_added(name) return if private_method_defined?(name) || /_tap/.match(name.to_s) || method_defined?("#{name}_without_tap") method = <<-EOS def #{name}_tap tap { #{name}_without_tap } end EOS self.class_eval(method) aliased_method = "alias #{name}_without_tap #{name}" self.class_eval(aliased_method) aliased_method = "alias #{name} #{name}_tap" self.class_eval(aliased_method) end |