pipe_envy 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pipe_envy.rb +9 -9
- data/lib/pipe_envy/version.rb +1 -1
- data/test/pipe_envy_test.rb +21 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '080aa59620533b2059024edc3fb85d1a08250244'
|
4
|
+
data.tar.gz: 5c61b072968eaa3ba762216549052164f58de7c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f165d4d4e9edfac77adbb473b86bed9f6b6fcb56305dc973fafb842d98cba22a6b309f5c8bedf23698ccae02cec670c2991b1312b7f08b99f69ee09e23894289
|
7
|
+
data.tar.gz: 2ffc4d39bdb40a6679b265d16db7a3bcb7aae1abc863c52c1ad98b9b4b39a628c7ea022f9621bc49f96072d7ae2f8d66fc1637f5f9a10127a0a01ba2461add85
|
data/lib/pipe_envy.rb
CHANGED
@@ -22,15 +22,15 @@ PIPE_ENVY_PIPE = -> (arg) do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
module PipeEnvy
|
25
|
-
|
26
|
-
|
25
|
+
def self.refine_pipe(klass)
|
26
|
+
refine klass do
|
27
|
+
define_method :|, &PIPE_ENVY_PIPE
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
define_method :|, &PIPE_ENVY_PIPE
|
35
|
-
end
|
31
|
+
refine_pipe Object
|
32
|
+
refine_pipe Array
|
33
|
+
refine_pipe Integer
|
34
|
+
refine_pipe Tempfile
|
35
|
+
refine_pipe Nokogiri::XML::NodeSet if defined? Nokogiri::XML::NodeSet
|
36
36
|
end
|
data/lib/pipe_envy/version.rb
CHANGED
data/test/pipe_envy_test.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
-
|
1
|
+
require "open-uri"
|
2
|
+
require "nokogiri"
|
2
3
|
require "coveralls"
|
3
4
|
Coveralls.wear!
|
4
5
|
SimpleCov.command_name "pry-test"
|
6
|
+
|
7
|
+
require_relative "../lib/pipe_envy"
|
5
8
|
using PipeEnvy
|
6
9
|
|
7
10
|
class PipeEnvyTest < PryTest::Test
|
@@ -38,4 +41,21 @@ class PipeEnvyTest < PryTest::Test
|
|
38
41
|
|
39
42
|
assert output == 7
|
40
43
|
end
|
44
|
+
|
45
|
+
# TODO: record http result so we don't request on each run
|
46
|
+
test "chainable methods repo example" do
|
47
|
+
output = "foo bar http://github.com/hopsoft/pipe_envy foo bar" \
|
48
|
+
| URI.method(:extract) \
|
49
|
+
| :first \
|
50
|
+
| URI.method(:parse) \
|
51
|
+
| :open \
|
52
|
+
| :readlines \
|
53
|
+
| :join \
|
54
|
+
| Nokogiri::HTML.method(:parse) \
|
55
|
+
| [:css, "h1"] \
|
56
|
+
| :first \
|
57
|
+
| :text \
|
58
|
+
| :strip
|
59
|
+
assert output == "hopsoft/pipe_envy"
|
60
|
+
end
|
41
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipe_envy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- natehop@gmail.com
|