mtg-db 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/data/cards.json +631994 -0
  2. data/data/sets.json +938 -0
  3. data/lib/mtg-db.rb +28 -0
  4. metadata +49 -0
data/lib/mtg-db.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'json'
2
+
3
+ module Mtg
4
+ module Db
5
+ VERSION = '0.0.1'
6
+
7
+ class << self
8
+ def cards(reload=false)
9
+ @cards = nil if reload
10
+ @cards ||= load_json File.expand_path('cards.json', 'data')
11
+ end
12
+
13
+ def sets(reload=false)
14
+ @sets = nil if reload
15
+ @sets ||= load_json File.expand_path('sets.json', 'data')
16
+ end
17
+
18
+ private
19
+
20
+ def load_json(path)
21
+ File.open(path, 'r') do |f|
22
+ JSON.parse(f.read)
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mtg-db
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gabe Smith
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-22 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ! 'An up-to-date database of Magic: The Gathering card and set data in
15
+ JSON format.'
16
+ email:
17
+ - sgt.floydpepper@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - lib/mtg-db.rb
23
+ - data/cards.json
24
+ - data/sets.json
25
+ homepage: https://github.com/sgtFloyd/mtg-db
26
+ licenses: []
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.24
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: ! 'A JSON database of Magic: The Gathering card and set data.'
49
+ test_files: []