awesome_print 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.3.1 RubyConf X edition
2
+ - Fixed Ruby 1.8.6 compatibility issues (thanks, Tim!)
3
+ - Fixed stack overflow issue with Rails 2.3.x console
4
+
1
5
  0.3.0
2
6
  - Display object.methods and family in human readable format
3
7
  - Objects inherited from Array, Hash, File, Dir, and Struct are shown as their base class
data/README.md CHANGED
@@ -259,10 +259,12 @@ For example:
259
259
  * Eloy Duran -- http://github.com/alloy
260
260
  * Benoit Daloze -- http://github.com/eregon
261
261
  * Sean Gallagher -- http://github.com/torandu
262
+ * Tim Harper -- http://github.com/timcharper
262
263
  * Tobias Crawley -- http://github.com/tobias
263
264
 
264
265
  ### License ###
265
- Copyright (c) 2010 Michael Dvorkin
266
+ Copyright (c) 2010 Michael Dvorkin
267
+ twitter.com/mid
266
268
  %w(mike dvorkin.net) * "@" || %w(mike fatfreecrm.com) * "@"
267
269
 
268
- Released under the MIT license. See LICENSE file for details.
270
+ Released under the MIT license. See LICENSE file for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/lib/ap.rb CHANGED
@@ -3,16 +3,12 @@
3
3
  # Awesome Print is freely distributable under the terms of MIT license.
4
4
  # See LICENSE file or http://www.opensource.org/licenses/mit-license.php
5
5
  #------------------------------------------------------------------------------
6
- require File.dirname(__FILE__) + "/ap/core_ext/array"
7
- require File.dirname(__FILE__) + "/ap/core_ext/string"
8
- require File.dirname(__FILE__) + "/ap/core_ext/object"
9
- require File.dirname(__FILE__) + "/ap/core_ext/class"
10
- require File.dirname(__FILE__) + "/ap/core_ext/kernel"
11
- require File.dirname(__FILE__) + "/ap/awesome_print"
12
-
13
- require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) or defined?(::ActiveSupport::BufferedLogger)
6
+ %w(array string method object class kernel).each do |file|
7
+ require File.dirname(__FILE__) + "/ap/core_ext/#{file}"
8
+ end
14
9
 
15
- require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView)
16
- require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord)
10
+ require File.dirname(__FILE__) + "/ap/awesome_print"
11
+ require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger)
12
+ require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView)
13
+ require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord)
17
14
  require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(::ActiveSupport)
18
-
@@ -261,7 +261,7 @@ class AwesomePrint
261
261
  end
262
262
  end
263
263
  else # See http://ruby-doc.org/core/classes/Method.html#M001902
264
- args = method.arity.abs.times.map { |i| "arg#{i+1}" }
264
+ args = (1..method.arity.abs).map { |i| "arg#{i}" }
265
265
  args[-1] = "*#{args[-1]}" if method.arity < 0
266
266
  end
267
267
 
@@ -10,7 +10,7 @@
10
10
  # ap [].methods - Object.methods
11
11
  # ap ''.methods.grep(/!|\?/)
12
12
  #
13
- # If you could think of a better way please let me know: twitter.com/mid :-)
13
+ # If you could think of a better way please let me know :-)
14
14
  #
15
15
  class Array #:nodoc:
16
16
  [ :-, :& ].each do |operator|
@@ -44,7 +44,7 @@ class Array #:nodoc:
44
44
  # doesn't set $1 within the grep block which causes nil.to_sym failure.
45
45
  # The workaround below has been tested with Ruby 1.8.7/Rails 2.3.8 and
46
46
  # Ruby 1.9.2/Rails 3.0.0. For more info see the following thread dating
47
- # back to 1993 when Ruby 1.8.0 was as fresh off the grill as Ruby 1.9.2
47
+ # back to 2003 when Ruby 1.8.0 was as fresh off the grill as Ruby 1.9.2
48
48
  # is in 2010 :-)
49
49
  #
50
50
  # http://www.justskins.com/forums/bug-when-rerouting-string-52852.html
@@ -14,5 +14,5 @@ module AwesomePrintLogger
14
14
 
15
15
  end
16
16
 
17
- Logger.send(:include, AwesomePrintLogger) if defined?(Logger)
17
+ Logger.send(:include, AwesomePrintLogger)
18
18
  ActiveSupport::BufferedLogger.send(:include, AwesomePrintLogger) if defined?(::ActiveSupport::BufferedLogger)
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2010 Michael Dvorkin
2
+ #
3
+ # Awesome Print is freely distributable under the terms of MIT license.
4
+ # See LICENSE file or http://www.opensource.org/licenses/mit-license.php
5
+ #------------------------------------------------------------------------------
6
+ #
7
+ # Method#name was intorduced in Ruby 1.8.7 so we define it here as necessary.
8
+ #
9
+ unless nil.method(:class).respond_to?(:name)
10
+ class Method
11
+ def name
12
+ inspect.split(/[#.>]/)[-1]
13
+ end
14
+ end
15
+
16
+ class UnboundMethod
17
+ def name
18
+ inspect.split(/[#.>]/)[-1]
19
+ end
20
+ end
21
+ end
@@ -10,16 +10,12 @@
10
10
  # gem 'awesome_print', '>= 0.2.1', :require => 'ap'
11
11
  # gem 'awesome_print', '>= 3.0.0'
12
12
  #
13
- require File.dirname(__FILE__) + "/ap/core_ext/array"
14
- require File.dirname(__FILE__) + "/ap/core_ext/string"
15
- require File.dirname(__FILE__) + "/ap/core_ext/object"
16
- require File.dirname(__FILE__) + "/ap/core_ext/class"
17
- require File.dirname(__FILE__) + "/ap/core_ext/kernel"
18
- require File.dirname(__FILE__) + "/ap/awesome_print"
19
-
20
- require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) or defined?(::ActiveSupport::BufferedLogger)
13
+ %w(array string method object class kernel).each do |file|
14
+ require File.dirname(__FILE__) + "/ap/core_ext/#{file}"
15
+ end
21
16
 
22
- require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView)
23
- require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord)
17
+ require File.dirname(__FILE__) + "/ap/awesome_print"
18
+ require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger)
19
+ require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView)
20
+ require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord)
24
21
  require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(::ActiveSupport)
25
-
@@ -1 +1,13 @@
1
- require File.join(File.dirname(__FILE__), "..", "init")
1
+ # Copyright (c) 2010 Michael Dvorkin
2
+ #
3
+ # Awesome Print is freely distributable under the terms of MIT license.
4
+ # See LICENSE file or http://www.opensource.org/licenses/mit-license.php
5
+ #------------------------------------------------------------------------------
6
+ #
7
+ # Load awesome_print when installed as Rails 2.3.x plugin.
8
+ #
9
+ # NOTE: After Rails 2.3.x console loads awesome_print/lib/ap.rb it attempts
10
+ # to load this file as well. Make sure to check whether the awesome_print
11
+ # is already loaded to avoid Ruby stack overflow when extending core classes.
12
+ #
13
+ require File.join(File.dirname(__FILE__), "..", "init") unless defined?(AwesomePrint)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Dvorkin
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-09 00:00:00 -08:00
17
+ date: 2010-11-13 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -53,6 +53,7 @@ files:
53
53
  - lib/ap/core_ext/class.rb
54
54
  - lib/ap/core_ext/kernel.rb
55
55
  - lib/ap/core_ext/logger.rb
56
+ - lib/ap/core_ext/method.rb
56
57
  - lib/ap/core_ext/object.rb
57
58
  - lib/ap/core_ext/string.rb
58
59
  - lib/ap/mixin/action_view.rb