piparote 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.md +69 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/piparote.rb +18 -0
- data/lib/piparote/version.rb +3 -0
- data/piparote.gemspec +27 -0
- data/piparote.png +0 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 23959f626b3cdf4f5aa3100cb2502174d63d1f9f
|
4
|
+
data.tar.gz: 1dc8de4c204984fd875a7fe75e15c8f66e65651c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b8aa8d51e160cf9072c0c331ea9221ee02a222ad2924e28c8ef24b31d8a936d1286de4e54ebd18458b4ee66204e5399b3f0570627ad91839d748d4aba6c2959
|
7
|
+
data.tar.gz: d7d6fa0138cea10508b1e3af08aa0368cdfb9f2f5c2060ad14fdc576c4a6d2c9c68e7f618b6b166606167fdc1b567d8093724270c000b4b920ddc3b0b7b08511
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Piparote
|
2
|
+
|
3
|
+

|
4
|
+
|
5
|
+
Another way to use Ruby object methods like pipes.
|
6
|
+
|
7
|
+
After reading [an
|
8
|
+
article](https://6ftdan.com/allyourdev/2017/08/03/elixir-envy-%e1%90%85-ruby/)
|
9
|
+
about Elixir's pipe operator and some implementation people made on Ruby, I made
|
10
|
+
this one as an exercise. Not sure if is good for production use.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'piparote'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install piparote
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
You can require the gem, include and use the `Piparote` module like this (here,
|
31
|
+
using Nokogiri to parse my website):
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
require 'uri'
|
35
|
+
require 'open-uri'
|
36
|
+
require 'nokogiri'
|
37
|
+
require 'piparote'
|
38
|
+
|
39
|
+
include Piparote
|
40
|
+
include Nokogiri
|
41
|
+
|
42
|
+
puts 'http://eustaquiorangel.com'.
|
43
|
+
URI.parse.
|
44
|
+
open.read.
|
45
|
+
HTML.parse.
|
46
|
+
css('h2').
|
47
|
+
map { |h2| h2.text }.
|
48
|
+
join(' - ')
|
49
|
+
|
50
|
+
=> Desenvolvedor, pai, metalhead - Publicado em Developer - E o carro estava na
|
51
|
+
garagem ... - Driver Driven Development
|
52
|
+
```
|
53
|
+
|
54
|
+
## Development
|
55
|
+
|
56
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
57
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
58
|
+
prompt that will allow you to experiment.
|
59
|
+
|
60
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
61
|
+
release a new version, update the version number in `version.rb`, and then run
|
62
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
63
|
+
git commits and tags, and push the `.gem` file to
|
64
|
+
[rubygems.org](https://rubygems.org).
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
Bug reports and pull requests are welcome on GitHub at
|
69
|
+
https://github.com/taq/piparote.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "piparote"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/piparote.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'piparote/version'
|
2
|
+
|
3
|
+
module Piparote
|
4
|
+
def method_missing(name, *args, &block)
|
5
|
+
return Piparote::Object.new(::Object.const_get(name), self) if name[0] =~ /[A-Z]/ && Object.const_defined?(name)
|
6
|
+
send(name, self, &block) if respond_to?(name)
|
7
|
+
end
|
8
|
+
|
9
|
+
class Object
|
10
|
+
def initialize(original, *args)
|
11
|
+
@original, @args = original, args
|
12
|
+
end
|
13
|
+
|
14
|
+
def method_missing(name, *args, &block)
|
15
|
+
@original.send(name, *@args, &block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/piparote.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'piparote/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'piparote'
|
9
|
+
spec.version = Piparote::VERSION
|
10
|
+
spec.authors = ['Eustaquio Rangel']
|
11
|
+
spec.email = ['taq@eustaquiorangel.com']
|
12
|
+
|
13
|
+
spec.summary = %q{Use object methods like Unix pipes}
|
14
|
+
spec.description = %q{Use object methods like Unix pipes}
|
15
|
+
spec.homepage = 'http://github.com/taq/piparote'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
27
|
+
end
|
data/piparote.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: piparote
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eustaquio Rangel
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-08 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.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: Use object methods like Unix pipes
|
56
|
+
email:
|
57
|
+
- taq@eustaquiorangel.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- Gemfile
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- bin/console
|
68
|
+
- bin/setup
|
69
|
+
- lib/piparote.rb
|
70
|
+
- lib/piparote/version.rb
|
71
|
+
- piparote.gemspec
|
72
|
+
- piparote.png
|
73
|
+
homepage: http://github.com/taq/piparote
|
74
|
+
licenses: []
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.6.12
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Use object methods like Unix pipes
|
96
|
+
test_files: []
|