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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6b2244ce4de2147a8080dd06244109cb9e2ddd90ae736c903df570884c3f0ec
4
- data.tar.gz: b669c79c7db828c49f2400468e41484ea9bfa2c0ea82cecebff3cee37b0bcb20
3
+ metadata.gz: 9de7f7828993e34f5b491e945a97d199d92264371ab74623c0f684963911696a
4
+ data.tar.gz: 1456ecb5bde4776daf6a6e5e523f2195e006c4c292ebf4ad8b50d45262925b1f
5
5
  SHA512:
6
- metadata.gz: 1edc22a6a94860bf8d05f02006918ea640be31cca225f5bc62a7683d468dab4066bb7bba0f0fa5e7e69871fba2f3377740088f474f504560c098a420c6c170d4
7
- data.tar.gz: 57f28cdbd0b16f5c22641367b27956c1b5d130f1b8038a65776befddeeedb58b0c7cfd994ad8a788f6125f752358d3261889e6f6b4186961fac27f60e15e5d58
6
+ metadata.gz: 11f42f239b24190e45a925b10932ab64987605fcba5021b8f773ee5627c757bfb1b2d61501c3fb12c214b2458a6cbc2375e5f3ff0df1f2523939287e379ea544
7
+ data.tar.gz: bc0365e1f975c9bc228fd214e4b56224a80d8c35338797205a0c028aa8aefe9274319cbe6dc876de3d295400c03c1f44a115cab1a1a535b66b2f3c315a2b3b26
@@ -1,3 +1,3 @@
1
1
  module TrickOrTreat
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -33,7 +33,7 @@ module TrickOrTreat
33
33
 
34
34
  def get_links
35
35
  nodes=Nokogiri::HTML(open(@uri)).css('a')
36
- nodes.collect{|n| n['href'] if n.child.to_s.match /trick/i}.compact
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.title.gsub(/.*?: (.*) \|.*/, '\1')
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.1
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-02 00:00:00.000000000 Z
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler