Class: Pokedex

Inherits:
Object
  • Object
show all
Defined in:
lib/botemon/pokedex.rb

Overview

– Copyright© 2013 Giovanni Capuano <[email protected]>

This file is part of Botémon.

Botémon is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Botémon is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Botémon. If not, see <www.gnu.org/licenses/>. ++

Class Method Summary collapse

Class Method Details

.get(name, storage) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/botemon/pokedex.rb', line 21

def self.get(name, storage)
  return nil if name == nil
  return storage.get(name) if storage.is_cached? name
  
  Smogon::Pokedex.get(name).tap { |pokemon|
    storage.add pokemon
    storage.save
  }
end