lib/tapp.rb in tapp-1.3.1 vs lib/tapp.rb in tapp-1.4.0
- old
+ new
@@ -1,53 +1,22 @@
-require 'tapp/version'
+require 'tapp/configuration'
+require 'tapp/deprecated'
+require 'tapp/object_extension'
+require 'tapp/printer'
module Tapp
- class << self
- attr_accessor :verbose
+ extend Deprecated
- def report_called
- return unless verbose
- method_quoted = caller[0].split(':in').last.strip
- puts "#{method_quoted} in #{caller[1]}"
+ class << self
+ def config
+ @config ||= Tapp::Configuration.new
end
- end
-end
-class Object
- def tapp
- require 'pp'
+ def configure
+ yield config
- Object.module_eval do
- remove_method :tapp
-
- def tapp
- Tapp.report_called
- tap { pp block_given? ? yield(self) : self }
- end
+ config
end
-
- tapp
end
-
- def taputs
- Tapp.report_called
- tap { puts block_given? ? yield(self) : self }
- end
-
- def taap
- require 'ap'
-
- Object.module_eval do
- remove_method :taap
-
- def taap
- Tapp.report_called
- tap { ap block_given? ? yield(self) : self }
- end
- end
-
- taap
- rescue LoadError
- warn "Sorry, you need to install awesome_print: `gem install awesome_print`"
- end
end
+Object.__send__ :include, Tapp::ObjectExtension