1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Added awesome_print.rb require file; minor tweaks before cutting 0.3.0

This commit is contained in:
Mike Dvorkin 2010-11-08 19:24:07 -08:00
parent e2039d9f06
commit 777d16d91b
3 changed files with 42 additions and 10 deletions

View file

@ -88,9 +88,22 @@ Supported color names:
$ cat > 4.rb
require "ap"
ap (''.methods - Object.methods).grep(/!/)
class Hello
def self.world(x, y, z = nil, &blk)
end
end
ap Hello.methods - Class.methods
^D
$ ruby 4.rb
[
[0] world(x, y, *z, &blk) Hello
]
$ cat > 5.rb
require "ap"
ap (''.methods - Object.methods).grep(/!/)
^D
$ ruby 5.rb
[
[ 0] capitalize!() String
[ 1] chomp!(*arg1) String
@ -229,15 +242,9 @@ For example:
### Running Specs ###
Ruby 1.8.7 and RSpec 1.3+:
$ rake spec # Entire spec suite.
$ ruby -rubygems spec/logger_spec.rb # Individual spec file.
Ruby 1.9.2 and RSpec 2.0+:
$ rake spec # Entire spec suite.
$ rspec spec/logger_spec.rb # Individual spec file.
$ ruby -rubygems spec/logger_spec.rb # Individual spec file (Ruby 1.8.7 and RSpec 1.3+)
$ rspec spec/logger_spec.rb # Individual spec file (Ruby 1.9.2 and RSpec 2.0+)
### Note on Patches/Pull Requests ###
* Fork the project on Github.

View file

@ -7,7 +7,7 @@ require "shellwords"
class AwesomePrint
AP = :__awesome_print__ unless defined?(AwesomePrint::AP)
CORE = [ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :method, :unboundmethod ].freeze unless defined?(AwesomePrint::CORE)
CORE = [ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :method, :unboundmethod ] unless defined?(AwesomePrint::CORE)
def initialize(options = {})
@options = {

25
lib/awesome_print.rb Executable file
View file

@ -0,0 +1,25 @@
# Copyright (c) 2010 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# This is the copy of original 'ap.rb' file that matches the gem name. It makes
# it possible to omit the :require part in bundler's Gemfile:
#
# gem 'awesome_print', '>= 0.2.1', :require => 'ap'
# gem 'awesome_print', '>= 3.0.0'
#
require File.dirname(__FILE__) + "/ap/core_ext/array"
require File.dirname(__FILE__) + "/ap/core_ext/string"
require File.dirname(__FILE__) + "/ap/core_ext/object"
require File.dirname(__FILE__) + "/ap/core_ext/class"
require File.dirname(__FILE__) + "/ap/core_ext/kernel"
require File.dirname(__FILE__) + "/ap/awesome_print"
require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) or defined?(::ActiveSupport::BufferedLogger)
require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView)
require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord)
require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(::ActiveSupport)