persondb-models 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3da2b33fdafe18b96c185cc7917c19da383f99c
4
- data.tar.gz: be15b5111437540510df731ad51315d97ed7de37
3
+ metadata.gz: e3ea4bb59d89558848fb8796b32e712210b1cfa4
4
+ data.tar.gz: 7392c52df086e03deba2d078f82f4caecff5c5f5
5
5
  SHA512:
6
- metadata.gz: 6d25360bbcfb330021ff1662838385e2b174fc61e0f2947e583e46b49e97b3977234f77f9d585f386aea4b6c853b18edbc5f57fde6619513ecbf070de360cc2d
7
- data.tar.gz: a16843304349ee92544a26e01f26d8781dddc80f704afba593973732d9dc2b0c0d0bb56dad4df26dba77af5e6e193b9da637cb10092450cf1efb27ef386aa349
6
+ metadata.gz: 28682887dfe9f105434045157d6e715c4165e326875410db512a379eb96c1f03f957e2f723cb2c8c384397f7da3b6dec7381d401ede19b8d917d144f7c37bc6f
7
+ data.tar.gz: 0d9402cc73e0cec129daaf947b1d133b66cf496227287c50427cb566afa03fa37d4885a1a67c4ed43be29b7a2c8229a16b3bdfe98e20c98cc8921907891b315b
@@ -7,7 +7,7 @@ lib/persondb/models/forward.rb
7
7
  lib/persondb/models/person.rb
8
8
  lib/persondb/models/world/city.rb
9
9
  lib/persondb/models/world/country.rb
10
- lib/persondb/models/world/region.rb
10
+ lib/persondb/models/world/state.rb
11
11
  lib/persondb/reader.rb
12
12
  lib/persondb/schema.rb
13
13
  lib/persondb/version.rb
@@ -14,7 +14,7 @@ require 'persondb/schema'
14
14
  require 'persondb/models/forward'
15
15
 
16
16
  require 'persondb/models/world/city'
17
- require 'persondb/models/world/region'
17
+ require 'persondb/models/world/state'
18
18
  require 'persondb/models/world/country'
19
19
 
20
20
  require 'persondb/models/person'
@@ -68,4 +68,4 @@ module PersonDb
68
68
  end # module PersonDb
69
69
 
70
70
  # say hello
71
- puts PersonDb.banner if $DEBUG || (defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG)
71
+ puts PersonDb.banner if defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG
@@ -7,7 +7,7 @@ module PersonDb
7
7
  ## todo: why? why not use include WorldDb::Models here???
8
8
  Continent = WorldDb::Model::Continent
9
9
  Country = WorldDb::Model::Country
10
- Region = WorldDb::Model::Region
10
+ State = WorldDb::Model::State
11
11
  City = WorldDb::Model::City
12
12
 
13
13
  Tagging = TagDb::Model::Tagging
@@ -1,9 +1,9 @@
1
1
  module WorldDb
2
2
  module Model
3
3
 
4
- class Region
5
- has_many :persons, class_name: 'PersonDb::Model::Person', foreign_key: 'region_id'
6
- end # class Region
4
+ class State
5
+ has_many :persons, class_name: 'PersonDb::Model::Person', foreign_key: 'state_id'
6
+ end # class State
7
7
 
8
8
  end # module Model
9
9
  end # module WorldDb
@@ -40,7 +40,7 @@ class PersonReader
40
40
  @more_attribs = more_attribs
41
41
  end
42
42
 
43
- def read()
43
+ def read
44
44
  reader = ValuesReader.from_string( @text, @more_attribs )
45
45
 
46
46
  reader.each_line do |new_attributes, values|
@@ -24,7 +24,7 @@ create_table :persons do |t|
24
24
  ## todo: add country of birth might not be the same as nationality
25
25
 
26
26
  t.references :city
27
- t.references :region
27
+ t.references :state
28
28
  t.references :country ## , null: false
29
29
 
30
30
  t.references :nationality ## , null: false # by default assume same as country of birth (see above)
@@ -3,8 +3,8 @@
3
3
  module PersonDb
4
4
 
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 4
7
- PATCH = 2
6
+ MINOR = 5
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -13,7 +13,7 @@ require 'persondb/models'
13
13
  ################
14
14
  # shortcuts
15
15
  Country = WorldDb::Model::Country
16
- Region = WorldDb::Model::Region
16
+ State = WorldDb::Model::State
17
17
  City = WorldDb::Model::City
18
18
 
19
19
  ## todo: get all models aliases (e.g. from console script)
@@ -15,15 +15,15 @@ class TestModels < MiniTest::Test
15
15
  def add_world
16
16
  ## add some counties
17
17
  at = Country.create!( key: 'at', title: 'Austria', code: 'AUT', pop: 0, area: 0 )
18
- n = Region.create!( key: 'n', title: 'Niederösterreich', country_id: at.id )
19
- feuersbrunn = City.create!( key: 'feuersbrunn', title: 'Feuersbrunn', country_id: at.id, region_id: n.id )
18
+ n = State.create!( key: 'n', title: 'Niederösterreich', country_id: at.id )
19
+ feuersbrunn = City.create!( key: 'feuersbrunn', title: 'Feuersbrunn', country_id: at.id, state_id: n.id )
20
20
  end
21
21
 
22
22
 
23
23
  def test_worlddb_assocs
24
- at = Country.find_by_key!( 'at' )
25
- n = Region.find_by_key!( 'n' )
26
- feuersbrunn = City.find_by_key!( 'feuersbrunn' )
24
+ at = Country.find_by!( key: 'at' )
25
+ n = State.find_by!( key: 'n' )
26
+ feuersbrunn = City.find_by!( key: 'feuersbrunn' )
27
27
 
28
28
  assert_equal 0, at.persons.count
29
29
  assert_equal 0, n.persons.count
@@ -17,11 +17,11 @@ class TestReader < MiniTest::Test
17
17
  end
18
18
 
19
19
  def test_read
20
- br = Country.find_by_key!( 'br' )
20
+ br = Country.find_by!( key: 'br' )
21
21
 
22
22
  path = "#{PersonDb.test_data_path}/players/south-america/br-brazil/players.txt"
23
23
  reader = PersonReader.from_file( path, country_id: br.id )
24
- reader.read()
24
+ reader.read
25
25
 
26
26
  assert_equal 23, Person.count
27
27
  assert_equal 23, br.persons.count
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persondb-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: worlddb-models
@@ -71,7 +71,7 @@ files:
71
71
  - lib/persondb/models/person.rb
72
72
  - lib/persondb/models/world/city.rb
73
73
  - lib/persondb/models/world/country.rb
74
- - lib/persondb/models/world/region.rb
74
+ - lib/persondb/models/world/state.rb
75
75
  - lib/persondb/reader.rb
76
76
  - lib/persondb/schema.rb
77
77
  - lib/persondb/version.rb