cute_print 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38450810673262d8825d6c9e249b8372df8f46a1
4
- data.tar.gz: 1a6af72afb22b28d3a940eb7e117457c8dc1b90c
3
+ metadata.gz: cd48df008664d805f7327ac22f50fe6339488c7a
4
+ data.tar.gz: b35db23f7554d066498810687044744a190605f3
5
5
  SHA512:
6
- metadata.gz: ac83eb665b16c82b9736eb1d8ff7719ff1590b7a2ed6631d927d59c7a35a4d519e3b5a311065354188e57f8830737baeabadd5acc752a417d25a62435ea0ccc0
7
- data.tar.gz: adaa3bc601bcbbd863949801d96f13af40db7017bf546f172550881c9eec14489beda90135ba2ea6e215e4afe4bb94ffe16fb390d773c3a4f0a4ec308a5adf8c
6
+ metadata.gz: a85b05749b5d7e351860cec2bd81e1f8f54f58c9eae9e5e6c42d7b24cf90dc15ebe40abf54645d8e8be81fb59bc231098d3de3ff0f31f8f2126fd71b5089ab24
7
+ data.tar.gz: fec09bdde9281690eceb0027929f0d19be1e1cf4f5d2faa0a87876ba518b93b370c0addb32f318f4d47b6a67cc35499be2c4651a7d7d1736cdcf30d134640509
data/CHANGELOG.md CHANGED
@@ -1,13 +1,16 @@
1
- ### Development
1
+ # 1.0.0 2014-12.13
2
2
 
3
- ### 0.4.0 2014-10-25
3
+ * Declare API stability with advent of v. 1.0.0
4
+ * Update gems
5
+
6
+ # 0.4.0 2014-10-25
4
7
 
5
8
  API changes
6
9
 
7
10
  * Can be used without patching any core Ruby classes (see README)
8
11
  * Use fewer output lines when possible while better respecting term width
9
12
 
10
- ### 0.3.0 / 2014-09-27
13
+ # 0.3.0 / 2014-09-27
11
14
 
12
15
  Breaking changes:
13
16
 
@@ -24,7 +27,7 @@ Bug fixes:
24
27
  * Works in irb (issue #1)
25
28
  * Is now thread safe (issue #4)
26
29
 
27
- ### 0.2.0 / 2014-09-05
30
+ # 0.2.0 / 2014-09-05
28
31
 
29
32
  Breaking changes:
30
33
 
@@ -38,6 +41,6 @@ Enhancements:
38
41
  * Added Kernel#qq (pretty-print)
39
42
  * Added Kernel#qql (pretty-print with source location)
40
43
 
41
- ### 0.1.0 / 2014-09-04
44
+ # 0.1.0 / 2014-09-04
42
45
 
43
46
  Initial release
data/Gemfile CHANGED
@@ -6,13 +6,13 @@ gem "ruby2ruby", "~> 2.1"
6
6
  group :test do
7
7
  gem "bundler", "~> 1.7"
8
8
  gem "cucumber", "~> 1.3"
9
- gem "rake", "~> 10.3"
10
- gem "rspec", "~> 3.0"
9
+ gem "rake", "~> 10.4"
10
+ gem "rspec", "~> 3.1"
11
11
  gem "rspec-given", "~> 3.5"
12
12
  end
13
13
 
14
14
  group :develop do
15
15
  gem "jeweler", "~> 2.0"
16
- gem "redcarpet", "~> 3.1"
16
+ gem "redcarpet", "~> 3.2"
17
17
  gem "yard", "~> 0.8.7"
18
18
  end
data/Gemfile.lock CHANGED
@@ -17,17 +17,17 @@ GEM
17
17
  gherkin (2.12.2)
18
18
  multi_json (~> 1.3)
19
19
  git (1.2.8)
20
- github_api (0.12.1)
20
+ github_api (0.12.2)
21
21
  addressable (~> 2.3)
22
22
  descendants_tracker (~> 0.0.4)
23
23
  faraday (~> 0.8, < 0.10)
24
- hashie (>= 3.2)
24
+ hashie (>= 3.3)
25
25
  multi_json (>= 1.7.5, < 2.0)
26
26
  nokogiri (~> 1.6.3)
27
27
  oauth2
28
28
  given_core (3.5.4)
29
29
  sorcerer (>= 0.3.7)
30
- hashie (3.3.1)
30
+ hashie (3.3.2)
31
31
  highline (1.6.21)
32
32
  jeweler (2.0.1)
33
33
  builder
@@ -39,14 +39,14 @@ GEM
39
39
  rake
40
40
  rdoc
41
41
  json (1.8.1)
42
- jwt (1.0.0)
43
- mini_portile (0.6.0)
42
+ jwt (1.2.0)
43
+ mini_portile (0.6.1)
44
44
  multi_json (1.10.1)
45
45
  multi_test (0.1.1)
46
46
  multi_xml (0.5.5)
47
47
  multipart-post (2.0.0)
48
- nokogiri (1.6.3.1)
49
- mini_portile (= 0.6.0)
48
+ nokogiri (1.6.5)
49
+ mini_portile (~> 0.6.0)
50
50
  oauth2 (1.0.0)
51
51
  faraday (>= 0.8, < 0.10)
52
52
  jwt (~> 1.0)
@@ -54,15 +54,15 @@ GEM
54
54
  multi_xml (~> 0.5)
55
55
  rack (~> 1.2)
56
56
  rack (1.5.2)
57
- rake (10.3.2)
58
- rdoc (4.1.2)
57
+ rake (10.4.2)
58
+ rdoc (4.2.0)
59
59
  json (~> 1.4)
60
- redcarpet (3.1.2)
60
+ redcarpet (3.2.2)
61
61
  rspec (3.1.0)
62
62
  rspec-core (~> 3.1.0)
63
63
  rspec-expectations (~> 3.1.0)
64
64
  rspec-mocks (~> 3.1.0)
65
- rspec-core (3.1.4)
65
+ rspec-core (3.1.7)
66
66
  rspec-support (~> 3.1.0)
67
67
  rspec-expectations (3.1.2)
68
68
  diff-lcs (>= 1.2.0, < 2.0)
@@ -70,9 +70,9 @@ GEM
70
70
  rspec-given (3.5.4)
71
71
  given_core (= 3.5.4)
72
72
  rspec (>= 2.12)
73
- rspec-mocks (3.1.2)
73
+ rspec-mocks (3.1.3)
74
74
  rspec-support (~> 3.1.0)
75
- rspec-support (3.1.1)
75
+ rspec-support (3.1.2)
76
76
  ruby2ruby (2.1.3)
77
77
  ruby_parser (~> 3.1)
78
78
  sexp_processor (~> 4.0)
@@ -81,7 +81,7 @@ GEM
81
81
  sexp_processor (4.4.4)
82
82
  sorcerer (1.0.2)
83
83
  thread_safe (0.3.4)
84
- yard (0.8.7.4)
84
+ yard (0.8.7.6)
85
85
 
86
86
  PLATFORMS
87
87
  ruby
@@ -90,9 +90,9 @@ DEPENDENCIES
90
90
  bundler (~> 1.7)
91
91
  cucumber (~> 1.3)
92
92
  jeweler (~> 2.0)
93
- rake (~> 10.3)
94
- redcarpet (~> 3.1)
95
- rspec (~> 3.0)
93
+ rake (~> 10.4)
94
+ redcarpet (~> 3.2)
95
+ rspec (~> 3.1)
96
96
  rspec-given (~> 3.5)
97
97
  ruby2ruby (~> 2.1)
98
98
  ruby_parser (~> 3.6)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 1.0.0
data/cute_print.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: cute_print 0.4.0 ruby lib
5
+ # stub: cute_print 1.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "cute_print"
9
- s.version = "0.4.0"
9
+ s.version = "1.0.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Wayne Conrad"]
14
- s.date = "2014-10-26"
14
+ s.date = "2014-12-13"
15
15
  s.description = "Write debug output to stderr. Optionally print the source filename and line number, or the source of the debug statement. Easily inspect the middle of a call chain."
16
16
  s.email = "wconrad@yagni.com"
17
17
  s.extra_rdoc_files = [
@@ -83,6 +83,7 @@ Gem::Specification.new do |s|
83
83
  "lib/cute_print/ruby_parser/wraps_sexp.rb",
84
84
  "lib/cute_print/source_label.rb",
85
85
  "lib/cute_print/stderr_out.rb",
86
+ "lib/cute_print/values.rb",
86
87
  "spec/cute_print_spec.rb",
87
88
  "spec/format/inspect_spec.rb",
88
89
  "spec/format/pretty_print_spec.rb",
@@ -105,7 +106,7 @@ Gem::Specification.new do |s|
105
106
  ]
106
107
  s.homepage = "http://github.com/wconrad/cute_print"
107
108
  s.licenses = ["MIT"]
108
- s.rubygems_version = "2.2.2"
109
+ s.rubygems_version = "2.4.4"
109
110
  s.summary = "print debug to stderr, with flair"
110
111
 
111
112
  if s.respond_to? :specification_version then
@@ -6,6 +6,7 @@ require_relative "labeler"
6
6
  require_relative "location"
7
7
  require_relative "location_label"
8
8
  require_relative "source_label"
9
+ require_relative "values"
9
10
 
10
11
  module CutePrint
11
12
  # @api private
@@ -17,19 +18,17 @@ module CutePrint
17
18
  @method = opts.fetch(:method)
18
19
  @out = opts.fetch(:out)
19
20
  @block = opts.fetch(:block, nil)
20
- @values = opts.fetch(:values, [])
21
+ @args = opts.fetch(:values, [])
22
+ @values = Values.new(@args, @block)
21
23
  @width = opts.fetch(:width, DEFAULT_WIDTH)
22
- if @block && !@values.empty?
23
- raise ArgumentError, "arguments and block are mutually exclusive"
24
- end
25
24
  @location_label = nil
26
25
  end
27
26
 
28
27
  def write
29
- if values.empty? && !label.empty?
28
+ if @values.empty? && !label.empty?
30
29
  write_line label.chomp(": ")
31
30
  else
32
- values.each do |value|
31
+ @values.each do |value|
33
32
  labeler = Labeler.new(@format, @width, label, value)
34
33
  write_lines labeler.labeled
35
34
  end
@@ -51,14 +50,6 @@ module CutePrint
51
50
 
52
51
  private
53
52
 
54
- def values
55
- if @block
56
- [@block.call]
57
- else
58
- @values
59
- end
60
- end
61
-
62
53
  def write_lines(lines)
63
54
  lines.each do |line|
64
55
  write_line line
@@ -0,0 +1,34 @@
1
+ require "forwardable"
2
+
3
+ module CutePrint
4
+
5
+ # @api private
6
+ class Values
7
+
8
+ extend Forwardable
9
+ include Enumerable
10
+
11
+ def initialize(args, block)
12
+ if !args.empty? && block
13
+ raise ArgumentError, "arguments and block are mutually exclusive"
14
+ end
15
+ @args = args
16
+ @block = block
17
+ end
18
+
19
+ def_delegator :values, :each
20
+ def_delegator :values, :empty?
21
+
22
+ private
23
+
24
+ def values
25
+ if @block
26
+ [@block.call]
27
+ else
28
+ @args
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cute_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne Conrad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-26 00:00:00.000000000 Z
11
+ date: 2014-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_parser
@@ -112,6 +112,7 @@ files:
112
112
  - lib/cute_print/ruby_parser/wraps_sexp.rb
113
113
  - lib/cute_print/source_label.rb
114
114
  - lib/cute_print/stderr_out.rb
115
+ - lib/cute_print/values.rb
115
116
  - spec/cute_print_spec.rb
116
117
  - spec/format/inspect_spec.rb
117
118
  - spec/format/pretty_print_spec.rb
@@ -151,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  version: '0'
152
153
  requirements: []
153
154
  rubyforge_project:
154
- rubygems_version: 2.2.2
155
+ rubygems_version: 2.4.4
155
156
  signing_key:
156
157
  specification_version: 4
157
158
  summary: print debug to stderr, with flair