smogon 0.4 → 0.4.1

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: 1bf05ec9749d9c9766d843099a44445197e4b840
4
- data.tar.gz: c7e0078c7a3fb4ae19eb7b562bca7e9d477f275c
3
+ metadata.gz: 9ba6ba8d6786aa123bc34b4044a46f118e5bcd5d
4
+ data.tar.gz: c5a5b8932d81bc6c67b4b689f36b3163df36ec27
5
5
  SHA512:
6
- metadata.gz: bd9640d7219e6c5d184bf6de991c4c7a1ba19e5c1165d7bb35237ae9bf81d9c2beb545e7d32c5b5cff563bb84f2b803216a8cadb03db27f4f03a49e8ce52af3c
7
- data.tar.gz: a6b6d35fa7dc5faa8adcb3498098087d62e8f6bf8de82b5a3ed174c3079e9a3d853c2e11d9f9c3c3b3f9b1299b693d74c08df3e83d8140770d517c6f0217e873
6
+ metadata.gz: 0c10dda50d5cb1e6edc7896863d872a732faae6527909f8438704510e0d8551981c7807acc56f90afadd71db108219bcf61c4e8fac09d1499a0d139beb1851b3
7
+ data.tar.gz: 5f32c923725fa660d84e7582f61267807866e4723f02f3ea416bf8862e042061139b489d81fcb9062a58dd1ba086b90fb9e1ef5a084ec34693fa3344e76b7494
@@ -37,21 +37,28 @@ module Smogon
37
37
  moveset.name = s.xpath('tr')[1].xpath('td[@class="name"]/h2').first.text
38
38
  moveset.tier = smogon.xpath('//div[@id="content_wrapper"]/ul/li/strong').last.text
39
39
 
40
- s.xpath('.//a').each { |a|
41
- moveset.item << a.text if a['href'].include? '/items/'
42
- moveset.ability << a.text if a['href'].include? '/abilities/'
43
- moveset.nature << a.text if a['href'].include? '/natures/'
44
- }
40
+ if metagame == 'gs'
41
+ s.xpath('.//a').each { |a|
42
+ moveset.item << a.text if a['href'].include? '/items/'
43
+ }
44
+ elsif metagame != 'rb'
45
+ s.xpath('.//a').each { |a|
46
+ moveset.item << a.text if a['href'].include? '/items/'
47
+ moveset.ability << a.text if a['href'].include? '/abilities/'
48
+ moveset.nature << a.text if a['href'].include? '/natures/'
49
+ }
50
+ end
45
51
 
46
52
  movesets << moveset
47
53
  }
48
54
 
49
55
  i = 0
50
- smogon.xpath('//table[@class="info moveset"]').each { |s|
56
+ xpath = metagame == 'rb' ? '//td[@class="rbymoves"]' : '//table[@class="info moveset"]'
57
+ smogon.xpath(xpath).each { |s|
51
58
  moveset = movesets[i]
52
59
 
53
60
  continue = false
54
- s.xpath('.//td')[0].text.each_line { |a|
61
+ (metagame == 'rb' ? s : s.xpath('.//td')[0]).text.each_line { |a|
55
62
  a = a.gsub(/\n?/, '').strip
56
63
  if a == ?~
57
64
  continue = false
@@ -69,7 +76,7 @@ module Smogon
69
76
  end
70
77
  }
71
78
 
72
- moveset.evs = s.xpath('.//td').last.text.strip
79
+ moveset.evs = s.xpath('.//td').last.text.strip if metagame != 'rb' && metagame != 'gs'
73
80
 
74
81
  movesets[i] = moveset
75
82
  i += 1
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Smogon
21
21
  def self.version
22
- '0.4'
22
+ '0.4.1'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smogon
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-31 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri