Module: SmogonDex
- Defined in:
- lib/smogon_dex.rb
Constant Summary collapse
- Catagories =
%w(pokemon moves abilities items formats types)
- Generations =
%w(xy dp gs bw rb rs)
- GEN_ARGS =
Generations.map {|gen| "--#{gen}"}
- CAT_ARGS =
Catagories.map {|catagory| "-#{catagory}"}
Class Method Summary collapse
Class Method Details
.homepage ⇒ Object
19 20 21 |
# File 'lib/smogon_dex.rb', line 19 def homepage Launchy.open "https://www.smogon.com/dex" end |
.search(data = Hash.new) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/smogon_dex.rb', line 10 def search(data=Hash.new) data[:gen] ||= "xy" data[:catagory] ||= "pokemon" data[:query] ||= String.new raise ArgumentError, "#{data[:gen]} is not a valid generation" unless Generations.include? data[:gen] raise ArgumentError, "#{data[:catagory]} is not a valid catagory." unless Catagories.include? data[:catagory] Launchy.open "https://www.smogon.com/dex/#{ data.fetch :gen }/#{ data.fetch :catagory }/#{ data.fetch :query }" end |