genealogy 0.1.1.beta1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2E0ZWFjOGVkNjE5NmI2NGYwOTFkNTBkOThhMWNkN2NiZGI5MGIyYw==
5
+ data.tar.gz: !binary |-
6
+ YTYwYTBlMDFlNTQxOTg4MDhjYTlmOTRmNGNhMGRlOWE2Zjg5NjViMA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjcxZmY0MmZiNmYwNWE3YWYxYzFhMTA0NjdkYjViYjhkZTMyMTBiOTdlMTgz
10
+ NDY2YmM2NWExMWE4OTZkN2Q3YmRjN2E4ZjYzYTRhOTBiYmFlYzQwODljNTZl
11
+ MGIzMzI5YzViNzU4MTEzNDdhNTAzNDQwM2U1NzY4ZTZlMjg1NWE=
12
+ data.tar.gz: !binary |-
13
+ MDYwMzcwNWFkNWE0M2Q5MmFmZDgzNjFhY2FiZWJmM2UyZjFjNTlhN2EwYWI3
14
+ ZjhiNDMyNjcwZDJlZDA4NzFmNzY3NDc5YjU1MThmZjNiM2YyODRjZjA3ZTQx
15
+ M2RiZjc3NDc5MmU0YjQ2M2Q3MzU4NzJjZjgxNGZmYTA2Y2I2NDg=
@@ -1,7 +1,7 @@
1
1
  require File.join(File.expand_path(File.dirname(__FILE__)), 'genealogy/constants')
2
2
  require File.join(File.expand_path(File.dirname(__FILE__)), 'genealogy/exceptions')
3
3
  require File.join(File.expand_path(File.dirname(__FILE__)), 'genealogy/query_methods')
4
- require File.join(File.expand_path(File.dirname(__FILE__)), 'genealogy/linking_methods')
4
+ require File.join(File.expand_path(File.dirname(__FILE__)), 'genealogy/alter_methods')
5
5
  require File.join(File.expand_path(File.dirname(__FILE__)), 'genealogy/spouse_methods')
6
6
  require File.join(File.expand_path(File.dirname(__FILE__)), 'genealogy/genealogy')
7
7
 
@@ -1,5 +1,5 @@
1
1
  module Genealogy
2
- module LinkingMethods
2
+ module AlterMethods
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  # parents
@@ -189,4 +189,5 @@ module Genealogy
189
189
  end
190
190
 
191
191
  end
192
- end
192
+ end
193
+
@@ -60,7 +60,8 @@ module Genealogy
60
60
 
61
61
  # Include instance methods and class methods
62
62
  include Genealogy::QueryMethods
63
- include Genealogy::LinkingMethods
63
+ include Genealogy::AlterMethods
64
+ include Genealogy::SpouseMethods if spouse_enabled
64
65
 
65
66
  end
66
67
 
@@ -56,27 +56,35 @@ module Genealogy
56
56
 
57
57
  def siblings(options = {})
58
58
  result = case options[:half]
59
+ when nil # exluding half siblings
60
+ father.try(:offspring, :spouse => mother ).to_a
59
61
  when :father # common father
60
- father.try(:offspring, options).to_a
62
+ father.try(:offspring, :spouse => options[:spouse]).to_a - mother.try(:offspring).to_a
61
63
  when :mother # common mother
62
- mother.try(:offspring, options).to_a
63
- when nil # exluding half siblings
64
- siblings(:half => :father) & siblings(:half => :mother)
64
+ mother.try(:offspring, :spouse => options[:spouse]).to_a - father.try(:offspring).to_a
65
65
  when :only # only half siblings
66
66
  siblings(:half => :include) - siblings
67
67
  when :include # including half siblings
68
- siblings(:half => :father) | siblings(:half => :mother)
68
+ father.try(:offspring).to_a + mother.try(:offspring).to_a
69
69
  else
70
70
  raise WrongOptionValueException, "Admitted values for :half options are: :father, :mother, false, true or nil"
71
71
  end
72
- result - [self]
72
+ result.uniq - [self]
73
73
  end
74
74
 
75
- def half_siblings(options = {})
75
+ def half_siblings
76
76
  siblings(:half => :only)
77
77
  # todo: inprove with option :father and :mother
78
78
  end
79
79
 
80
+ def paternal_half_siblings
81
+ siblings(:half => :father)
82
+ end
83
+
84
+ def maternal_half_siblings
85
+ siblings(:half => :mother)
86
+ end
87
+
80
88
  def ancestors
81
89
  result = []
82
90
  remaining = parents.to_a.compact
@@ -1,3 +1,3 @@
1
1
  module Genealogy
2
- VERSION = "0.1.1.beta1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genealogy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.beta1
5
- prerelease: 6
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - masciugo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-21 00:00:00.000000000 Z
11
+ date: 2013-05-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: sqlite3
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: debugger
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -116,36 +103,35 @@ extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
118
105
  - lib/genealogy.rb
106
+ - lib/genealogy/alter_methods.rb
119
107
  - lib/genealogy/constants.rb
120
108
  - lib/genealogy/exceptions.rb
121
109
  - lib/genealogy/genealogy.rb
122
- - lib/genealogy/linking_methods.rb
123
110
  - lib/genealogy/query_methods.rb
124
111
  - lib/genealogy/spouse_methods.rb
125
112
  - lib/genealogy/version.rb
126
113
  homepage: https://github.com//genealogy
127
114
  licenses:
128
115
  - MIT
116
+ metadata: {}
129
117
  post_install_message:
130
118
  rdoc_options: []
131
119
  require_paths:
132
120
  - lib
133
121
  required_ruby_version: !ruby/object:Gem::Requirement
134
- none: false
135
122
  requirements:
136
123
  - - ! '>='
137
124
  - !ruby/object:Gem::Version
138
125
  version: '0'
139
126
  required_rubygems_version: !ruby/object:Gem::Requirement
140
- none: false
141
127
  requirements:
142
- - - ! '>'
128
+ - - ! '>='
143
129
  - !ruby/object:Gem::Version
144
- version: 1.3.1
130
+ version: '0'
145
131
  requirements: []
146
132
  rubyforge_project: ! '[none]'
147
- rubygems_version: 1.8.24
133
+ rubygems_version: 2.0.3
148
134
  signing_key:
149
- specification_version: 3
135
+ specification_version: 4
150
136
  summary: Organise ActiveRecord models into a genealogical tree structure
151
137
  test_files: []