trick_or_treat 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trick_or_treat/version.rb +1 -1
- data/lib/trick_or_treat.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9de7f7828993e34f5b491e945a97d199d92264371ab74623c0f684963911696a
|
4
|
+
data.tar.gz: 1456ecb5bde4776daf6a6e5e523f2195e006c4c292ebf4ad8b50d45262925b1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11f42f239b24190e45a925b10932ab64987605fcba5021b8f773ee5627c757bfb1b2d61501c3fb12c214b2458a6cbc2375e5f3ff0df1f2523939287e379ea544
|
7
|
+
data.tar.gz: bc0365e1f975c9bc228fd214e4b56224a80d8c35338797205a0c028aa8aefe9274319cbe6dc876de3d295400c03c1f44a115cab1a1a535b66b2f3c315a2b3b26
|
data/lib/trick_or_treat.rb
CHANGED
@@ -33,7 +33,7 @@ module TrickOrTreat
|
|
33
33
|
|
34
34
|
def get_links
|
35
35
|
nodes=Nokogiri::HTML(open(@uri)).css('a')
|
36
|
-
nodes.
|
36
|
+
nodes.map{|n| n['href'] if n.attributes['class'].value.match /trick/i}.compact
|
37
37
|
end
|
38
38
|
|
39
39
|
def trick
|
@@ -42,9 +42,8 @@ module TrickOrTreat
|
|
42
42
|
link=links.sample
|
43
43
|
f=open([@uri,link].join('/'))
|
44
44
|
html=Nokogiri::HTML(f)
|
45
|
-
puts title=html.
|
45
|
+
puts title=html.css('h1').text.gsub(/ +|\n/, '')
|
46
46
|
content=html.css('.post-content')
|
47
|
-
content.children[0..1].remove
|
48
47
|
IO.popen("less", "w") do |f|
|
49
48
|
f.puts "\e[1m#{title}\e[0m\n#{content.text}"
|
50
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trick_or_treat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Romero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|