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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbf66e669e3f292fc9b155dc75993c09fa9c1014
4
- data.tar.gz: 59b48abc5c93d18e1bd75c441a81731bc0b017b0
3
+ metadata.gz: '080aa59620533b2059024edc3fb85d1a08250244'
4
+ data.tar.gz: 5c61b072968eaa3ba762216549052164f58de7c7
5
5
  SHA512:
6
- metadata.gz: a6c6e8cdd366cb365844ebdd2e98368167950bbfd800ff51667f48b35f3db66fc22b5e26b84aad7b7ff8d9c27cae227e6e23303e27dc1ea327a4bf9db48fb44c
7
- data.tar.gz: b6478a260e15d66d325ba37501614ced5c3c994459c7ad800144c3d34fa5f6b39de7218f6c9b016101774270bdec1ae91031614d699000047e1e63a57e736fbc
6
+ metadata.gz: f165d4d4e9edfac77adbb473b86bed9f6b6fcb56305dc973fafb842d98cba22a6b309f5c8bedf23698ccae02cec670c2991b1312b7f08b99f69ee09e23894289
7
+ data.tar.gz: 2ffc4d39bdb40a6679b265d16db7a3bcb7aae1abc863c52c1ad98b9b4b39a628c7ea022f9621bc49f96072d7ae2f8d66fc1637f5f9a10127a0a01ba2461add85
@@ -22,15 +22,15 @@ PIPE_ENVY_PIPE = -> (arg) do
22
22
  end
23
23
 
24
24
  module PipeEnvy
25
- refine Object do
26
- define_method :|, &PIPE_ENVY_PIPE
25
+ def self.refine_pipe(klass)
26
+ refine klass do
27
+ define_method :|, &PIPE_ENVY_PIPE
28
+ end
27
29
  end
28
30
 
29
- refine Array do
30
- define_method :|, &PIPE_ENVY_PIPE
31
- end
32
-
33
- refine Integer do
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
@@ -1,3 +1,3 @@
1
1
  module PipeEnvy
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,7 +1,10 @@
1
- require_relative "../lib/pipe_envy"
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.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-28 00:00:00.000000000 Z
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