good_print 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: efd0e338cdb5bddeb201aded80819d77a57011b3
4
+ data.tar.gz: ca4e6bd0e4434364512fd9d7300203f4e55e8819
5
+ SHA512:
6
+ metadata.gz: f510679f0d8919edca3454525fc49742cd02039a36ec97e3d06bcb6adc34d02f0d96c794294120da158e6e6383009d35038907efdde209a71679b01c4f80b3ef
7
+ data.tar.gz: 84e7308870c28df5b2da5e75f5855afad44f5b511868aa4a1220b90c1fac8fe39b9af919cc3063e077383f6fa6a0862685268bcd2b61c21aebe970deac9b8d3c
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in good_print.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Mark Dodwell
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # GoodPrint
2
+
3
+ Not as awesome as awesome_print.
4
+
5
+ ```ruby
6
+ >> require 'good_print'
7
+ => true
8
+
9
+ >> thing = { one: 1, two: 2, three: { array: [3.1, 3.2], hash: { one: 3.1, two: 3.2 }, string: "hello" }, four: [4.1, 4.2, 4.3] }
10
+ => {:one=>1, :two=>2, :three=>{:array=>[3.1, 3.2], :hash=>{:one=>3.1, :two=>3.2}, :string=>"hello"}, :four=>[4.1, 4.2, 4.3]}
11
+
12
+ >> gp thing
13
+ {
14
+ :one => 1,
15
+ :two => 2,
16
+ :three => {
17
+ :array => [
18
+ 3.1,
19
+ 3.2
20
+ ],
21
+ :hash => {
22
+ :one => 3.1,
23
+ :two => 3.2
24
+ },
25
+ :string => "hello"
26
+ },
27
+ :four => [
28
+ 4.1,
29
+ 4.2,
30
+ 4.3
31
+ ]
32
+ }
33
+ ```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'good_print/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "good_print"
8
+ spec.version = GoodPrint::VERSION
9
+ spec.authors = ["Mark Dodwell"]
10
+ spec.email = ["mark@mkdynamic.co.uk"]
11
+ spec.summary = "Not as awesome as awesome_print."
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ end
@@ -0,0 +1,3 @@
1
+ module GoodPrint
2
+ VERSION = "0.0.1"
3
+ end
data/lib/good_print.rb ADDED
@@ -0,0 +1,46 @@
1
+ require "good_print/version"
2
+
3
+ module GoodPrint
4
+ class << self
5
+ GP_INDENT = 2
6
+
7
+ def gp_puts(string, level, trailer = false, end_with_comma = false)
8
+ prefix = trailer ? "" : " " * GP_INDENT * level
9
+ suffix = end_with_comma ? "," : ""
10
+ puts "#{prefix}#{string}#{suffix}"
11
+ end
12
+
13
+ def gp_print(string, level, trailer = false, end_with_comma = false)
14
+ prefix = trailer ? "" : " " * GP_INDENT * level
15
+ suffix = end_with_comma ? "," : ""
16
+ print "#{prefix}#{string}#{suffix}"
17
+ end
18
+
19
+ def gp(object, level = 0, trailer = false, end_with_comma = false)
20
+ case object
21
+ when Hash
22
+ gp_puts "{", level, trailer
23
+ object.each_pair.each_with_index do |(k, v), idx|
24
+ gp_print "#{k.inspect} => ", level + 1
25
+ gp v, level + 1, true, idx < object.size - 1
26
+ end
27
+ gp_puts "}", level, false, end_with_comma
28
+ when Enumerable
29
+ prefix = if (defined? Set) && object.is_a?(Set)
30
+ "<Set>"
31
+ end
32
+ gp_puts "#{prefix}[", level, trailer
33
+ object.each_with_index do |v, idx|
34
+ gp v, level + 1, false, idx < object.size - 1
35
+ end
36
+ gp_puts "]", level, false, end_with_comma
37
+ else
38
+ gp_puts "#{object.inspect}", level, trailer, end_with_comma
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ def gp(*args)
45
+ GoodPrint.gp(*args)
46
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: good_print
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mark Dodwell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - mark@mkdynamic.co.uk
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - good_print.gemspec
54
+ - lib/good_print.rb
55
+ - lib/good_print/version.rb
56
+ homepage: ''
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.2.2
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Not as awesome as awesome_print.
80
+ test_files: []