awesome_print 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/Appraisals +11 -0
  4. data/CHANGELOG.md +10 -0
  5. data/CONTRIBUTING.md +1 -1
  6. data/README.md +47 -38
  7. data/Rakefile +5 -5
  8. data/lib/ap.rb +2 -2
  9. data/lib/awesome_print.rb +18 -17
  10. data/lib/awesome_print/colorize.rb +1 -1
  11. data/lib/awesome_print/core_ext/{array.rb → awesome_method_array.rb} +16 -18
  12. data/lib/awesome_print/core_ext/class.rb +3 -2
  13. data/lib/awesome_print/core_ext/kernel.rb +1 -1
  14. data/lib/awesome_print/core_ext/logger.rb +1 -1
  15. data/lib/awesome_print/core_ext/method.rb +2 -2
  16. data/lib/awesome_print/core_ext/object.rb +3 -2
  17. data/lib/awesome_print/core_ext/string.rb +3 -3
  18. data/lib/awesome_print/custom_defaults.rb +57 -0
  19. data/lib/awesome_print/ext/action_view.rb +8 -4
  20. data/lib/awesome_print/ext/active_record.rb +19 -11
  21. data/lib/awesome_print/ext/active_support.rb +1 -1
  22. data/lib/awesome_print/ext/mongo_mapper.rb +16 -13
  23. data/lib/awesome_print/ext/mongoid.rb +8 -6
  24. data/lib/awesome_print/ext/nobrainer.rb +8 -5
  25. data/lib/awesome_print/ext/nokogiri.rb +4 -4
  26. data/lib/awesome_print/ext/ostruct.rb +1 -1
  27. data/lib/awesome_print/ext/ripple.rb +5 -6
  28. data/lib/awesome_print/ext/sequel.rb +7 -6
  29. data/lib/awesome_print/formatter.rb +11 -19
  30. data/lib/awesome_print/formatters.rb +15 -0
  31. data/lib/awesome_print/formatters/array_formatter.rb +108 -42
  32. data/lib/awesome_print/formatters/base_formatter.rb +13 -11
  33. data/lib/awesome_print/formatters/class_formatter.rb +2 -1
  34. data/lib/awesome_print/formatters/dir_formatter.rb +1 -1
  35. data/lib/awesome_print/formatters/file_formatter.rb +1 -1
  36. data/lib/awesome_print/formatters/hash_formatter.rb +74 -22
  37. data/lib/awesome_print/formatters/object_formatter.rb +9 -14
  38. data/lib/awesome_print/formatters/struct_formatter.rb +71 -0
  39. data/lib/awesome_print/inspector.rb +77 -93
  40. data/lib/awesome_print/version.rb +2 -2
  41. data/spec/active_record_helper.rb +8 -2
  42. data/spec/colors_spec.rb +30 -30
  43. data/spec/core_ext/logger_spec.rb +43 -0
  44. data/spec/core_ext/string_spec.rb +20 -0
  45. data/spec/ext/action_view_spec.rb +18 -0
  46. data/spec/ext/active_record_spec.rb +252 -0
  47. data/spec/ext/active_support_spec.rb +26 -0
  48. data/spec/ext/mongo_mapper_spec.rb +261 -0
  49. data/spec/ext/mongoid_spec.rb +104 -0
  50. data/spec/ext/nobrainer_spec.rb +59 -0
  51. data/spec/ext/nokogiri_spec.rb +46 -0
  52. data/spec/ext/ostruct_spec.rb +22 -0
  53. data/spec/ext/ripple_spec.rb +48 -0
  54. data/spec/formats_spec.rb +193 -165
  55. data/spec/methods_spec.rb +116 -128
  56. data/spec/misc_spec.rb +104 -108
  57. data/spec/objects_spec.rb +70 -28
  58. data/spec/spec_helper.rb +27 -10
  59. data/spec/support/active_record_data.rb +20 -0
  60. data/spec/support/active_record_data/3_2_diana.txt +24 -0
  61. data/spec/support/active_record_data/3_2_diana_legacy.txt +24 -0
  62. data/spec/support/active_record_data/3_2_multi.txt +50 -0
  63. data/spec/support/active_record_data/3_2_multi_legacy.txt +50 -0
  64. data/spec/support/active_record_data/4_0_diana.txt +98 -0
  65. data/spec/support/active_record_data/4_0_multi.txt +198 -0
  66. data/spec/support/active_record_data/4_1_diana.txt +97 -0
  67. data/spec/support/active_record_data/4_1_multi.txt +196 -0
  68. data/spec/support/active_record_data/4_2_diana.txt +109 -0
  69. data/spec/support/active_record_data/4_2_diana_legacy.txt +109 -0
  70. data/spec/support/active_record_data/4_2_multi.txt +220 -0
  71. data/spec/support/active_record_data/4_2_multi_legacy.txt +220 -0
  72. data/spec/support/active_record_data/5_0_diana.txt +105 -0
  73. data/spec/support/active_record_data/5_0_multi.txt +212 -0
  74. data/spec/support/ext_verifier.rb +42 -0
  75. data/spec/support/mongoid_versions.rb +22 -0
  76. data/spec/support/rails_versions.rb +35 -0
  77. metadata +79 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99b8a5036bd1ecee2419c7b8dd40c4d532be0d3b
4
- data.tar.gz: 76664afa8dcdc3113e0563dbab551c15eb88fc7d
3
+ metadata.gz: cda3844883c76081eb1cbaf6e6188492b51d741d
4
+ data.tar.gz: be404804711ff00ce4f3720153bf84ba10d012ef
5
5
  SHA512:
6
- metadata.gz: 1c1351608b30f507cd3147eb6ef4a54d328919f46b30c75b5c60561f506db2b6ef5c7faacf62020a21e6a0e8fb7feebeb3c57b246acb25e72452338ecd347d12
7
- data.tar.gz: 61497937047523ccd15d81ac8c0059e0a2ddcac9d505832513ed1ac8300fff46fa496da3a4e33f5c2e92b70dd2ba0b8c6c8ed3f45bac393902ce524464235df0
6
+ metadata.gz: 3a83fe61488d2df035585c6d54f9e93dfa5c950bef2a7e05707fdb334090bf91db46921d88f2fac136edf13904ee0c76393e5a7c4d4d5f53cf9b460a0f724696
7
+ data.tar.gz: 87d8c72172448c0897c668cbefcfe4713802effa219469297ce8b242307998c70f82a087feeb7f0b485ee34941bd833aa5eb14c322143242f09b8f3e7418bc5c
data/.gitignore CHANGED
@@ -23,6 +23,9 @@ pkg
23
23
  .ruby-version
24
24
  gemfiles/*.gemfile.lock
25
25
  Gemfile.lock
26
+ /tmp
27
+ /.bundle
28
+ /gemfiles/.bundle
26
29
 
27
30
  ## PROJECT::RVM
28
31
  .rvmrc
data/Appraisals CHANGED
@@ -4,6 +4,7 @@ end
4
4
 
5
5
  appraise 'rails-4.0' do
6
6
  gem 'rails', '~> 4.0.0'
7
+ gem 'json', '~> 1.8', :platforms => :ruby_19 # Json 2.0 requires Ruby >= 2.0
7
8
 
8
9
  # The last version that doesn't need Ruby 2.0 and works with version 4.0 of
9
10
  # Rails. This addresses a build problem with Travis for version 1.9.3 of Ruby
@@ -26,12 +27,18 @@ appraise 'rails-4.2' do
26
27
  gem 'mime-types', '2.6.2', :platforms => :ruby_19
27
28
  end
28
29
 
30
+ appraise 'rails-5.0' do
31
+ # Only works with Ruby >= 2.2
32
+ gem 'rails', '>= 5.0.0.racecar1', '< 5.1'
33
+ end
34
+
29
35
  appraise 'mongoid-3.0' do
30
36
  gem 'mongoid', '~> 3.0.0'
31
37
  end
32
38
 
33
39
  appraise 'mongoid-3.1' do
34
40
  gem 'mongoid', '~> 3.1.0'
41
+ gem 'json', '~> 1.8', :platforms => :ruby_19 # Json 2.0 requires Ruby >= 2.0
35
42
  end
36
43
 
37
44
  appraise 'mongoid-4.0' do
@@ -49,4 +56,8 @@ end
49
56
 
50
57
  appraise 'nobrainer' do
51
58
  gem 'nobrainer'
59
+
60
+ # When activesupport 5 was released, it required ruby 2.2.2 as a minimum.
61
+ # Locking this down to 4.2.6 allows our Ruby 1.9 tests to keep working.
62
+ gem 'activesupport', '4.2.6', :platforms => :ruby_19
52
63
  end
@@ -1,5 +1,12 @@
1
1
  ## master (unreleased)
2
+ - new things!
2
3
 
4
+ ## 1.8.0
5
+ - stat("$HOME/.aprc") once [@kstephens] - [#304]
6
+ - ActiveRecord: #joins now show the columns #select'ed [@adrianomitre] - [#211]
7
+ - Handles NoMethodError for IRB implicit `ai` [@jtnegrotto] - [#212]
8
+ - Replaced Fixnum reference with Integer
9
+ - Colorize ORM class names [@ixti]
3
10
 
4
11
  ## 1.7.0
5
12
  - Refactoring by extracting formatters into their own classes [@waldyr] - [#237]
@@ -129,6 +136,7 @@
129
136
  - Initial Release.
130
137
 
131
138
  [#200]: https://github.com/awesome-print/awesome_print/pull/200
139
+ [#212]: https://github.com/awesome-print/awesome_print/pull/212
132
140
  [#216]: https://github.com/awesome-print/awesome_print/pull/216
133
141
  [#217]: https://github.com/awesome-print/awesome_print/pull/217
134
142
  [#222]: https://github.com/awesome-print/awesome_print/pull/222
@@ -145,6 +153,8 @@
145
153
  [@clonezone]: https://github.com/clonezone
146
154
  [@cyberdelia]: https://github.com/cyberdelia
147
155
  [@gerrywastaken]: https://github.com/gerrywastaken
156
+ [@ixti]: https://github.com/ixti
157
+ [@jtnegrotto]: https://github.com/jtnegrotto
148
158
  [@kemmason]: https://github.com/kemmason
149
159
  [@maurogeorge]: https://github.com/maurogeorge
150
160
  [@MaxPleaner]: https://github.com/MaxPleaner
@@ -6,7 +6,7 @@ We love pull requests. Here's a quick guide:
6
6
 
7
7
  1. Create your feature branch (`git checkout -b my-new-feature`)
8
8
 
9
- 1. Update [CHANGELOG.md](https://github.com/michaeldv/awesome_print/blob/master/CHANGELOG.md) with a brief description of your changes under the `unreleased` heading.
9
+ 1. Update [CHANGELOG.md](https://github.com/awesome-print/awesome_print/blob/master/CHANGELOG.md) with a brief description of your changes under the `unreleased` heading.
10
10
 
11
11
  1. Add/Update tests were appropriate
12
12
 
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Code Climate][code_climate_badge]][code_climate]
6
6
  [![Code Climate Coverage][code_climate_coverage_badge]][code_climate]
7
7
  [![RubyGems][gem_downloads_badge]][ruby_gems]
8
- [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/michaeldv/awesome_print?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
+ [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/awesome-print/awesome_print?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
9
9
 
10
10
 
11
11
  Awesome Print is a Ruby library that pretty prints Ruby objects in full color
@@ -21,7 +21,7 @@ v2.0 will *require* Ruby v1.9.3 or later and Rails v3.0 or later.
21
21
  $ gem install awesome_print
22
22
 
23
23
  # Cloning the repository
24
- $ git clone git://github.com/michaeldv/awesome_print.git
24
+ $ git clone git://github.com/awesome-print/awesome_print.git
25
25
 
26
26
  ### Usage ###
27
27
 
@@ -33,34 +33,36 @@ ap object, options = {}
33
33
  Default options:
34
34
 
35
35
  ```ruby
36
- :indent => 4, # Indent using 4 spaces.
37
- :index => true, # Display array indices.
38
- :html => false, # Use ANSI color codes rather than HTML.
39
- :multiline => true, # Display in multiple lines.
40
- :plain => false, # Use colors.
41
- :raw => false, # Do not recursively format object instance variables.
42
- :sort_keys => false, # Do not sort hash keys.
43
- :limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer.
44
- :color => {
45
- :args => :pale,
46
- :array => :white,
47
- :bigdecimal => :blue,
48
- :class => :yellow,
49
- :date => :greenish,
50
- :falseclass => :red,
51
- :fixnum => :blue,
52
- :float => :blue,
53
- :hash => :pale,
54
- :keyword => :cyan,
55
- :method => :purpleish,
56
- :nilclass => :red,
57
- :rational => :blue,
58
- :string => :yellowish,
59
- :struct => :pale,
60
- :symbol => :cyanish,
61
- :time => :greenish,
62
- :trueclass => :green,
63
- :variable => :cyanish
36
+ indent: 4, # Number of spaces for indenting.
37
+ index: true, # Display array indices.
38
+ html: false, # Use ANSI color codes rather than HTML.
39
+ multiline: true, # Display in multiple lines.
40
+ plain: false, # Use colors.
41
+ raw: false, # Do not recursively format instance variables.
42
+ sort_keys: false, # Do not sort hash keys.
43
+ sort_vars: true, # Sort instance variables.
44
+ limit: false, # Limit arrays & hashes. Accepts bool or int.
45
+ ruby19_syntax: false, # Use Ruby 1.9 hash syntax in output.
46
+ color: {
47
+ args: :pale,
48
+ array: :white,
49
+ bigdecimal: :blue,
50
+ class: :yellow,
51
+ date: :greenish,
52
+ falseclass: :red,
53
+ fixnum: :blue,
54
+ float: :blue,
55
+ hash: :pale,
56
+ keyword: :cyan,
57
+ method: :purpleish,
58
+ nilclass: :red,
59
+ rational: :blue,
60
+ string: :yellowish,
61
+ struct: :pale,
62
+ symbol: :cyanish,
63
+ time: :greenish,
64
+ trueclass: :green,
65
+ variable: :cyanish
64
66
  }
65
67
  ```
66
68
 
@@ -303,6 +305,14 @@ With other web frameworks (ex: in Sinatra templates) you can explicitly request
303
305
  formatting:
304
306
 
305
307
  <%= ap @accounts.first, :html => true %>
308
+
309
+ ### String Convenience Methods ###
310
+ Use methods such as `.red` to set string color:
311
+
312
+ ```ruby
313
+ irb> puts "red text".red
314
+ red text # (it's red)
315
+ ```
306
316
 
307
317
  ### Setting Custom Defaults ###
308
318
  You can set your own default options by creating ``.aprc`` file in your home
@@ -325,11 +335,10 @@ AwesomePrint.defaults = {
325
335
  AwesomePrint follows the [Semantic Versioning](http://semver.org/) standard.
326
336
 
327
337
  ### Contributing ###
328
- See [Contributing.md](https://github.com/michaeldv/awesome_print/blob/master/CONTRIBUTING.md)
329
- for information.
338
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for information.
330
339
 
331
340
  ### License ###
332
- Copyright (c) 2010-2013 Michael Dvorkin
341
+ Copyright (c) 2010-2016 Michael Dvorkin and contributors
333
342
 
334
343
  http://www.dvorkin.net
335
344
 
@@ -340,8 +349,8 @@ Released under the MIT license. See LICENSE file for details.
340
349
  [gem_version_badge]: https://img.shields.io/gem/v/awesome_print.svg?style=flat
341
350
  [gem_downloads_badge]: http://img.shields.io/gem/dt/awesome_print.svg?style=flat
342
351
  [ruby_gems]: http://rubygems.org/gems/awesome_print
343
- [travis_ci]: http://travis-ci.org/michaeldv/awesome_print
344
- [travis_ci_badge]: https://img.shields.io/travis/michaeldv/awesome_print/master.svg?style=flat
345
- [code_climate]: https://codeclimate.com/github/michaeldv/awesome_print
346
- [code_climate_badge]: http://img.shields.io/codeclimate/github/michaeldv/awesome_print.svg?style=flat
347
- [code_climate_coverage_badge]: https://codeclimate.com/github/michaeldv/awesome_print/badges/coverage.svg
352
+ [travis_ci]: http://travis-ci.org/awesome-print/awesome_print
353
+ [travis_ci_badge]: https://img.shields.io/travis/awesome-print/awesome_print/master.svg?style=flat
354
+ [code_climate]: https://codeclimate.com/github/awesome-print/awesome_print
355
+ [code_climate_badge]: http://img.shields.io/codeclimate/github/awesome-print/awesome_print.svg?style=flat
356
+ [code_climate_coverage_badge]: https://codeclimate.com/github/awesome-print/awesome_print/badges/coverage.svg
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
- require "rubygems"
2
- require "bundler/setup"
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
3
 
4
- require "bundler"
4
+ require 'bundler'
5
5
  Bundler::GemHelper.install_tasks
6
6
 
7
7
  task :default do
@@ -16,9 +16,9 @@ task :appraise do
16
16
  exec 'appraisal install && appraisal rake'
17
17
  end
18
18
 
19
- desc "Run all awesome_print gem specs"
19
+ desc 'Run all awesome_print gem specs'
20
20
  task :spec do
21
21
  # Run plain rspec command without RSpec::Core::RakeTask overrides.
22
- exec "rspec -c spec"
22
+ exec 'rspec -c spec'
23
23
  end
24
24
 
data/lib/ap.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -7,4 +7,4 @@
7
7
  # Keeping this for backwards compatibility to allow
8
8
  # require "ap"
9
9
  #
10
- require File.dirname(__FILE__) + "/awesome_print"
10
+ require File.dirname(__FILE__) + '/awesome_print'
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -8,33 +8,34 @@
8
8
  # so do nothing for subsequent requires.
9
9
  #
10
10
  unless defined?(AwesomePrint::Inspector)
11
- %w(array string method object class kernel).each do |file|
12
- require File.dirname(__FILE__) + "/awesome_print/core_ext/#{file}"
11
+ %w(awesome_method_array string method object class kernel).each do |file|
12
+ require "awesome_print/core_ext/#{file}"
13
13
  end
14
14
 
15
- require File.dirname(__FILE__) + "/awesome_print/inspector"
16
- require File.dirname(__FILE__) + "/awesome_print/formatter"
17
- require File.dirname(__FILE__) + "/awesome_print/version"
18
- require File.dirname(__FILE__) + "/awesome_print/core_ext/logger" if defined?(Logger)
15
+ require 'awesome_print/custom_defaults'
16
+ require 'awesome_print/inspector'
17
+ require 'awesome_print/formatter'
18
+ require 'awesome_print/version'
19
+ require 'awesome_print/core_ext/logger' if defined?(Logger)
19
20
  #
20
21
  # Load the following under normal circumstances as well as in Rails
21
22
  # console when required from ~/.irbrc or ~/.pryrc.
22
23
  #
23
- require File.dirname(__FILE__) + "/awesome_print/ext/active_record" if defined?(ActiveRecord) || AwesomePrint.rails_console?
24
- require File.dirname(__FILE__) + "/awesome_print/ext/active_support" if defined?(ActiveSupport) || AwesomePrint.rails_console?
24
+ require 'awesome_print/ext/active_record' if defined?(ActiveRecord) || AwesomePrint.rails_console?
25
+ require 'awesome_print/ext/active_support' if defined?(ActiveSupport) || AwesomePrint.rails_console?
25
26
  #
26
27
  # Load remaining extensions.
27
28
  #
28
29
  if defined?(ActiveSupport.on_load)
29
30
  ActiveSupport.on_load(:action_view) do
30
- require File.dirname(__FILE__) + "/awesome_print/ext/action_view"
31
+ require 'awesome_print/ext/action_view'
31
32
  end
32
33
  end
33
- require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper)
34
- require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid)
35
- require File.dirname(__FILE__) + "/awesome_print/ext/nokogiri" if defined?(Nokogiri)
36
- require File.dirname(__FILE__) + "/awesome_print/ext/nobrainer" if defined?(NoBrainer)
37
- require File.dirname(__FILE__) + "/awesome_print/ext/ripple" if defined?(Ripple)
38
- require File.dirname(__FILE__) + "/awesome_print/ext/sequel" if defined?(Sequel)
39
- require File.dirname(__FILE__) + "/awesome_print/ext/ostruct" if defined?(OpenStruct)
34
+ require 'awesome_print/ext/mongo_mapper' if defined?(MongoMapper)
35
+ require 'awesome_print/ext/mongoid' if defined?(Mongoid)
36
+ require 'awesome_print/ext/nokogiri' if defined?(Nokogiri)
37
+ require 'awesome_print/ext/nobrainer' if defined?(NoBrainer)
38
+ require 'awesome_print/ext/ripple' if defined?(Ripple)
39
+ require 'awesome_print/ext/sequel' if defined?(Sequel)
40
+ require 'awesome_print/ext/ostruct' if defined?(OpenStruct)
40
41
  end
@@ -1,4 +1,4 @@
1
- autoload :CGI, "cgi"
1
+ autoload :CGI, 'cgi'
2
2
 
3
3
  module AwesomePrint
4
4
  module Colorize
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -12,24 +12,24 @@
12
12
  #
13
13
  # If you could think of a better way please let me know :-)
14
14
  #
15
- class Array #:nodoc:
16
- [ :-, :& ].each do |operator|
17
- original_operator = instance_method(operator)
15
+ module AwesomeMethodArray #:nodoc:
18
16
 
19
- define_method operator do |*args|
20
- arr = original_operator.bind(self).call(*args)
21
- if self.instance_variable_defined?('@__awesome_methods__')
22
- arr.instance_variable_set('@__awesome_methods__', self.instance_variable_get('@__awesome_methods__'))
23
- arr.sort! { |a, b| a.to_s <=> b.to_s } # Need the block since Ruby 1.8.x can't sort arrays of symbols.
24
- end
25
- arr
17
+ def -(_other_ary)
18
+ super.tap do |arr|
19
+ arr.instance_variable_set(:@__awesome_methods__, self.instance_variable_get(:@__awesome_methods__))
20
+ end
21
+ end
22
+
23
+ def &(_other_ary)
24
+ super.tap do |arr|
25
+ arr.instance_variable_set(:@__awesome_methods__, self.instance_variable_get(:@__awesome_methods__))
26
26
  end
27
27
  end
28
+
28
29
  #
29
30
  # Intercepting Array#grep needs a special treatment since grep accepts
30
31
  # an optional block.
31
32
  #
32
- alias :original_grep :grep
33
33
  def grep(pattern, &blk)
34
34
  #
35
35
  # The following looks rather insane and I've sent numerous hours trying
@@ -55,9 +55,9 @@ class Array #:nodoc:
55
55
  # the comment :-)
56
56
  #
57
57
  arr = unless blk
58
- original_grep(pattern)
58
+ super(pattern)
59
59
  else
60
- original_grep(pattern) do |match|
60
+ super(pattern) do |match|
61
61
  #
62
62
  # The binding can only be used with Ruby-defined methods, therefore
63
63
  # we must rescue potential "ArgumentError: Can't create Binding from
@@ -72,10 +72,8 @@ class Array #:nodoc:
72
72
  yield match
73
73
  end
74
74
  end
75
- if self.instance_variable_defined?('@__awesome_methods__')
76
- arr.instance_variable_set('@__awesome_methods__', self.instance_variable_get('@__awesome_methods__'))
77
- arr.reject! { |item| !(item.is_a?(Symbol) || item.is_a?(String)) } # grep block might return crap.
78
- end
75
+ arr.instance_variable_set(:@__awesome_methods__, self.instance_variable_get(:@__awesome_methods__))
76
+ arr.reject! { |item| !(item.is_a?(Symbol) || item.is_a?(String)) } # grep block might return crap.
79
77
  arr
80
78
  end
81
79
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -15,7 +15,8 @@ class Class #:nodoc:
15
15
 
16
16
  define_method name do |*args|
17
17
  methods = original_method.bind(self).call(*args)
18
- methods.instance_variable_set('@__awesome_methods__', self)
18
+ methods.instance_variable_set(:@__awesome_methods__, self)
19
+ methods.extend(AwesomeMethodArray)
19
20
  methods
20
21
  end
21
22
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -18,4 +18,4 @@ unless nil.method(:class).respond_to?(:name)
18
18
  inspect.split(/[#.>]/)[-1]
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -15,7 +15,8 @@ class Object #:nodoc:
15
15
 
16
16
  define_method name do |*args|
17
17
  methods = original_method.bind(self).call(*args)
18
- methods.instance_variable_set('@__awesome_methods__', self)
18
+ methods.instance_variable_set(:@__awesome_methods__, self)
19
+ methods.extend(AwesomeMethodArray)
19
20
  methods
20
21
  end
21
22
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2013 Michael Dvorkin
1
+ # Copyright (c) 2010-2016 Michael Dvorkin and contributors
2
2
  #
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
@@ -17,11 +17,11 @@ class String
17
17
  %w(gray red green yellow blue purple cyan white).zip(
18
18
  %w(black darkred darkgreen brown navy darkmagenta darkcyan slategray)).each_with_index do |(color, shade), i|
19
19
  define_method color do |*html|
20
- html[0] ? %Q|<kbd style="color:#{color}">#{self}</kbd>| : "\e[1;#{30+i}m#{self}\e[0m"
20
+ html[0] ? %Q|<kbd style="color:#{color}">#{self}</kbd>| : "\e[1;#{30 + i}m#{self}\e[0m"
21
21
  end
22
22
 
23
23
  define_method "#{color}ish" do |*html|
24
- html[0] ? %Q|<kbd style="color:#{shade}">#{self}</kbd>| : "\e[0;#{30+i}m#{self}\e[0m"
24
+ html[0] ? %Q|<kbd style="color:#{shade}">#{self}</kbd>| : "\e[0;#{30 + i}m#{self}\e[0m"
25
25
  end
26
26
  end
27
27