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:
parent
e2039d9f06
commit
777d16d91b
3 changed files with 42 additions and 10 deletions
25
README.md
25
README.md
|
@ -88,9 +88,22 @@ Supported color names:
|
||||||
|
|
||||||
$ cat > 4.rb
|
$ cat > 4.rb
|
||||||
require "ap"
|
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
|
^D
|
||||||
$ ruby 4.rb
|
$ 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
|
[ 0] capitalize!() String
|
||||||
[ 1] chomp!(*arg1) String
|
[ 1] chomp!(*arg1) String
|
||||||
|
@ -229,15 +242,9 @@ For example:
|
||||||
|
|
||||||
### Running Specs ###
|
### Running Specs ###
|
||||||
|
|
||||||
Ruby 1.8.7 and RSpec 1.3+:
|
|
||||||
|
|
||||||
$ rake spec # Entire spec suite.
|
$ rake spec # Entire spec suite.
|
||||||
$ ruby -rubygems 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+)
|
||||||
Ruby 1.9.2 and RSpec 2.0+:
|
|
||||||
|
|
||||||
$ rake spec # Entire spec suite.
|
|
||||||
$ rspec spec/logger_spec.rb # Individual spec file.
|
|
||||||
|
|
||||||
### Note on Patches/Pull Requests ###
|
### Note on Patches/Pull Requests ###
|
||||||
* Fork the project on Github.
|
* Fork the project on Github.
|
||||||
|
|
|
@ -7,7 +7,7 @@ require "shellwords"
|
||||||
|
|
||||||
class AwesomePrint
|
class AwesomePrint
|
||||||
AP = :__awesome_print__ unless defined?(AwesomePrint::AP)
|
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 = {})
|
def initialize(options = {})
|
||||||
@options = {
|
@options = {
|
||||||
|
|
25
lib/awesome_print.rb
Executable file
25
lib/awesome_print.rb
Executable 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)
|
||||||
|
|
Loading…
Reference in a new issue