oakdex-pokedex 0.1.4 → 0.1.5

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
  SHA256:
3
- metadata.gz: 6ed6bc8c5ec990d83aa7d3bc794336bd2274f56bb11b465133971229470dad8f
4
- data.tar.gz: 9b32d76b37d4dd64667804d66f16e588569cb9ec06b9d20a065e61443b09cf4c
3
+ metadata.gz: 31003d4ab9220837934b8ffe9b93a86c351edfc28e776f6920ed0d4cea6fd30a
4
+ data.tar.gz: 7895c628bfbb89c025cd46c656018a052e4d10e9dbeaec7ce0a52d51ab085f7f
5
5
  SHA512:
6
- metadata.gz: 7ec1d2b14ef511c0820db34740692c065dec4de536e044ccac59afc644001c73f41b498ffec76aaf7ae241eba10aadb19c109c0e9c0eee5fda748793775e9f97
7
- data.tar.gz: 024c021d1adb24dd93b451bac5faf5fe6df573dc4e61427be90198bd03bd37f1cd10814732b89fb597e1d3da8c78794482315b1536e7c5be2acc142a1b219658
6
+ metadata.gz: 02f6a38626aea6f7f55b860c4d47a4380537ec386e8df8913d34d53a559a0a3f8f1b3a763f2045f7b4f44574fbdb323ec2282de7c01bcd93daca07e0f0fd9a04
7
+ data.tar.gz: 26d4d3d3437bc381547451ad72a9858c48b1a08bc446a70f9f9a35c8dc2edf41bad57aa22ef46909ca0f9cf426c64516358142f194c0ef7190a90e16450967a7
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'oakdex/pokedex/not_found'
2
3
  require 'oakdex/pokedex/type'
3
4
  require 'oakdex/pokedex/nature'
4
5
  require 'oakdex/pokedex/ability'
@@ -25,6 +25,11 @@ module Oakdex
25
25
  all[name]
26
26
  end
27
27
 
28
+ def find!(name)
29
+ find(name) ||
30
+ (raise NotFound, "#{name} (#{json_folder}) could not be found")
31
+ end
32
+
28
33
  def where(conditions = {})
29
34
  all.values.select do |entry|
30
35
  conditions.all? do |name, value|
@@ -0,0 +1,9 @@
1
+ require 'oakdex/pokedex/base'
2
+
3
+ module Oakdex
4
+ module Pokedex
5
+ # Exception if entry does not exist
6
+ class NotFound < StandardError
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Oakdex
2
2
  module Pokedex
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oakdex-pokedex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jalyna Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-10 00:00:00.000000000 Z
11
+ date: 2018-03-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pokedex for Gen 1-7, in JSON and accessible through Ruby.
14
14
  email: jalyna.schroeder@gmail.com
@@ -32,6 +32,7 @@ files:
32
32
  - lib/oakdex/pokedex/generation.rb
33
33
  - lib/oakdex/pokedex/move.rb
34
34
  - lib/oakdex/pokedex/nature.rb
35
+ - lib/oakdex/pokedex/not_found.rb
35
36
  - lib/oakdex/pokedex/pokemon.rb
36
37
  - lib/oakdex/pokedex/type.rb
37
38
  - lib/oakdex/pokedex/version.rb