piparote 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in piparote.gemspec
4
+ gemspec
@@ -0,0 +1,69 @@
1
+ # Piparote
2
+
3
+ ![Piparote](https://github.com/taq/piparote/raw/master/piparote.png)
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.
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -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
@@ -0,0 +1,3 @@
1
+ module Piparote
2
+ VERSION = "0.1.0"
3
+ end
@@ -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
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: []