smogon 0.3.2 → 0.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07aa8cbc5c8ffac43e2196f4abf8304df43ebcaa
4
- data.tar.gz: 3fbb5810e7025067fd66a966901bdb7b26496430
3
+ metadata.gz: 68899beb3f6cac4f510727d7af5cda4457b4126e
4
+ data.tar.gz: 839f085730d3a701c65ed3b52acb1f3ba41e1326
5
5
  SHA512:
6
- metadata.gz: 13a68cc142d1dad593940ab66a7c974ef0b62096caa500b05bf04361440f5bb7487cb7507b886e747a27a04b306c8a989292dea8a317feeb9aa0d31b6e6c00ac
7
- data.tar.gz: ca10f8a5c2e275f799263768250e43c399fc363f606a84672c2add6670251d4683559f3948a054e8c569b2ea9d27162941745930d7b1cd1f92ed60d4a92e9cb9
6
+ metadata.gz: 7c5e651aec97357258a8a44e01019819bed0672b88c524a79fb77bc359fab25a95cd6d74eee05fafaf11b87a07f8dd874ced4f1190ad40af5af158e8fa3b1ce4
7
+ data.tar.gz: ee3619904557d8a85f35feb86c07c3a9fe170cd3d5770867567d71e9bb7827554444808ef87f858bb0390a3adf44ddf283c3fa066d918300e0798bd101045951
@@ -19,9 +19,9 @@
19
19
 
20
20
  module Smogon
21
21
  class Movesetdex
22
- def self.get(name, tier)
22
+ def self.get(name, tier, metagame)
23
23
  begin
24
- url = URI::encode "http://www.smogon.com/bw/pokemon/#{name}/#{tier}"
24
+ url = URI::encode "http://www.smogon.com/#{metagame}/pokemon/#{name}/#{tier}"
25
25
 
26
26
  smogon = Nokogiri::HTML(open(url))
27
27
  rescue
@@ -38,9 +38,9 @@ module Smogon
38
38
  moveset.tier = smogon.xpath('//div[@id="content_wrapper"]/ul/li/strong').last.text
39
39
 
40
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/'
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
44
  }
45
45
 
46
46
  movesets << moveset
@@ -63,7 +63,7 @@ module Smogon
63
63
  if continue
64
64
  moveset.moves.last << a
65
65
  else
66
- (moveset.moves ||= []) << [a]
66
+ moveset.moves << [a]
67
67
  end
68
68
  continue = false
69
69
  end
@@ -22,6 +22,13 @@ module Smogon
22
22
  class Moveset
23
23
  attr_accessor :pokemon, :name, :tier, :item, :ability, :nature, :moves, :evs
24
24
 
25
+ def initialize
26
+ @item = []
27
+ @ability = []
28
+ @nature = []
29
+ @moves = []
30
+ end
31
+
25
32
  def to_s
26
33
  "Pokémon: #{pokemon}\nSet: #{name}\nItem: #{item.join(' / ')}\nAbility: #{ability.join(' / ')}\nNature: #{nature.join(' / ')}\nMoves: #{''.tap { |s| moves.each { |move| s << move.join(' / ') + ', '}}[0..-3]}\nEVs: #{evs}"
27
34
  end
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Smogon
21
21
  def self.version
22
- '0.3.2'
22
+ '0.3.3'
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.3.2
4
+ version: 0.3.3
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-07-18 00:00:00.000000000 Z
11
+ date: 2013-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: API written in Ruby to get (Poké|Ability|Move|Moveset)dex from Smogon.
27
+ description: API to get (Poké|Ability|Item|Move|Moveset)dex from Smogon
28
28
  email: webmaster@giovannicapuano.net
29
29
  executables: []
30
30
  extensions: []
@@ -63,5 +63,5 @@ rubyforge_project:
63
63
  rubygems_version: 2.0.3
64
64
  signing_key:
65
65
  specification_version: 4
66
- summary: Smogon API in Ruby.
66
+ summary: API for Smogon.
67
67
  test_files: []