epitools 0.5.63 → 0.5.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/epitools/autoloads.rb +8 -0
- data/lib/epitools/core_ext/numbers.rb +3 -0
- data/lib/epitools/core_ext/string.rb +18 -6
- data/spec/core_ext_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c97e30eb1552bb115bad441fa21bf0c5e1a58a10
|
4
|
+
data.tar.gz: 5559b075618fdc77e4bc55ece12b42dc8cf4ad49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b61f7535b2d27d437bedc30197de4de5b09a4d2234f8580c33779a37b9337031e31a6e071995ffeb111ef87a195dec7502ee5aba42b15d7899d836a5980888bf
|
7
|
+
data.tar.gz: cb9807f3b5953ece8e40171aa48363042c5610a28aea82c1702f6b7ce3c2f536106294f7b06a45b42b86491715b83b05267d65b15609fdf14e46df3cd51f97fb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.64
|
data/lib/epitools/autoloads.rb
CHANGED
@@ -59,6 +59,14 @@ autoreq :ANSI, 'ansi'
|
|
59
59
|
autoreq :BSON, 'bson'
|
60
60
|
autoreq :JSON, 'json'
|
61
61
|
|
62
|
+
autoreq :AwesomePrint do
|
63
|
+
require 'awesome_print'
|
64
|
+
|
65
|
+
autoreq :Nokogiri do
|
66
|
+
require 'nokogiri'
|
67
|
+
require 'awesome_print/ext/nokogiri'
|
68
|
+
end
|
69
|
+
end
|
62
70
|
|
63
71
|
## Network stuff
|
64
72
|
|
@@ -141,8 +141,12 @@ class String
|
|
141
141
|
alias_method :indent_html, :nice_html
|
142
142
|
|
143
143
|
#
|
144
|
-
#
|
145
|
-
#
|
144
|
+
# Word-wrap the string so each line is at most `width` wide.
|
145
|
+
# Returns a string, or, if a block is given, yields each
|
146
|
+
# word-wrapped line to the block.
|
147
|
+
#
|
148
|
+
# If `width` is nil, find the current width of the terminal and use that.
|
149
|
+
# If `width` is negative, subtract `width` from the terminal's current width.
|
146
150
|
#
|
147
151
|
def wrap(width=nil)
|
148
152
|
if width.nil? or width < 0
|
@@ -150,7 +154,7 @@ class String
|
|
150
154
|
_, winwidth = STDIN.winsize
|
151
155
|
|
152
156
|
if width < 0
|
153
|
-
width = (winwidth
|
157
|
+
width = (winwidth - 1) + width
|
154
158
|
else
|
155
159
|
width = winwidth - 1
|
156
160
|
end
|
@@ -184,18 +188,26 @@ class String
|
|
184
188
|
end
|
185
189
|
end
|
186
190
|
|
191
|
+
alias_method :word_wrap, :wrap
|
192
|
+
|
193
|
+
|
187
194
|
#
|
188
195
|
# Wrap all lines at window size, and indent
|
189
196
|
#
|
190
|
-
def
|
197
|
+
def wrap_and_indent(prefix, width=nil)
|
198
|
+
prefix = " "*prefix if prefix.is_a? Numeric
|
199
|
+
|
200
|
+
prefix_size = prefix.strip_color.size
|
201
|
+
|
191
202
|
if width
|
192
|
-
width = width -
|
203
|
+
width = width - prefix_size
|
193
204
|
else
|
194
|
-
width = -
|
205
|
+
width = -prefix_size
|
195
206
|
end
|
196
207
|
|
197
208
|
wrap(width).each_line.map { |line| prefix + line }.join
|
198
209
|
end
|
210
|
+
alias_method :wrapdent, :wrap_and_indent
|
199
211
|
|
200
212
|
#
|
201
213
|
# Iterate over slices of the string of size `slice_width`.
|
data/spec/core_ext_spec.rb
CHANGED
@@ -747,7 +747,7 @@ end
|
|
747
747
|
describe ObjectSpace do
|
748
748
|
|
749
749
|
it "is Enumerable" do
|
750
|
-
ObjectSpace.select { |o| o.is_a?
|
750
|
+
ObjectSpace.select { |o| o.is_a? ObjectSpace }.map { |o| o.class.name }.uniq.should == ["Module"]
|
751
751
|
end
|
752
752
|
|
753
753
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epitools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.64
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- epitron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|