Module: Pokeedex

Defined in:
lib/pokeedex.rb,
lib/pokeedex/version.rb,
lib/pokeedex/database.rb,
lib/pokeedex/exceptions.rb,
lib/pokeedex/pokemon/base.rb,
lib/pokeedex/configuration.rb,
lib/pokeedex/install_playwright.rb,
lib/pokeedex/pokemon/model/base.rb,
lib/pokeedex/pokemon/scrapper/base.rb,
lib/pokeedex/pokemon/searcher/base.rb,
lib/pokeedex/pokemon/decorators/base.rb,
lib/pokeedex/pokemon/scrapper/pokedex.rb,
lib/pokeedex/pokemon/scrapper/parsers/base.rb,
lib/pokeedex/pokemon/scrapper/fetchers/base.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Exceptions, Pokemon Classes: Configuration, Database, InstallPlaywright

Constant Summary collapse

VERSION =
'0.1.5'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.root_pathObject (readonly)

Return the root path of the gem

Example

> Pokeedex.root_path
> "/path/to/pokeedex"


27
28
29
# File 'lib/pokeedex.rb', line 27

def root_path
  @root_path
end

Class Method Details

.configurationObject

The configuration of the gem



32
33
34
# File 'lib/pokeedex.rb', line 32

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Configure the gem with a block of configuration

Yields:



38
39
40
# File 'lib/pokeedex.rb', line 38

def self.configure
  yield(configuration)
end

.connect_to_databaseObject

Connect to the database and run the migrations



44
45
46
47
48
49
# File 'lib/pokeedex.rb', line 44

def self.connect_to_database
  Database.connect(configuration)
  Database.run_migrations!

  require_relative 'pokeedex/pokemon/model/base'
end

.initObject

Init the gem by connecting to the database and running the migrations if needed and loading the models



53
54
55
56
57
# File 'lib/pokeedex.rb', line 53

def self.init
  InstallPlaywright.run!

  connect_to_database
end