towsta 2.0.5 → 2.0.6
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.
- data/lib/towsta/synchronizer.rb +2 -2
- data/lib/towsta/version.rb +1 -1
- data/lib/towsta/vertical-core/.attributes.rb.swn +0 -0
- data/lib/towsta/vertical-core/.references.rb.swn +0 -0
- data/lib/towsta/vertical-core/attributes.rb +9 -0
- data/lib/towsta/vertical-core/references.rb +0 -14
- data/lib/towsta/vertical.rb +2 -1
- metadata +5 -3
data/lib/towsta/synchronizer.rb
CHANGED
@@ -53,8 +53,8 @@ module Towsta
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def populate_verticals
|
56
|
-
Vertical.populate 'User', @hash[:users]
|
57
|
-
@hash[:structures].each_with_index {|structure, i| Vertical.populate(structure[:name], @hash[:verticals][i][:horizontals], @hash[:verticals][i][:occurrences])}
|
56
|
+
Vertical.populate 'User', @hash[:users], @hash[:users].size
|
57
|
+
@hash[:structures].each_with_index {|structure, i| Vertical.populate(structure[:name], @hash[:verticals][i][:horizontals], structure[:count], @hash[:verticals][i][:occurrences])}
|
58
58
|
end
|
59
59
|
|
60
60
|
def remote_string
|
data/lib/towsta/version.rb
CHANGED
Binary file
|
Binary file
|
@@ -42,6 +42,15 @@ module Towsta
|
|
42
42
|
@#{attr}
|
43
43
|
end
|
44
44
|
|
45
|
+
def self.find_by_#{attr} value
|
46
|
+
self.all.each { |horizontal| return horizontal if horizontal.object_of_#{attr}.compare value }
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.find_all_by_#{attr} value
|
51
|
+
self.all.select { |horizontal| horizontal.object_of_#{attr}.compare value }
|
52
|
+
end
|
53
|
+
|
45
54
|
")
|
46
55
|
self.attributes ||= []
|
47
56
|
self.attributes << attr.to_sym
|
@@ -25,20 +25,6 @@ module Towsta
|
|
25
25
|
self.all[rand(position)]
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.find_by attr, value
|
29
|
-
self.all.each { |horizontal| return horizontal if horizontal.send(:"object_of_#{attr}").compare value }
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.find_all_by attr, value
|
33
|
-
self.all.select { |horizontal| horizontal.send(:"object_of_#{attr}").compare value }
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.method_missing m, *args, &block
|
37
|
-
return self.find_by Regexp.last_match(1), args.first if m =~ /find_by_(.+)/
|
38
|
-
return self.find_all_by Regexp.last_match(1), args.first if m =~ /find_all_by_(.+)/
|
39
|
-
super
|
40
|
-
end
|
41
|
-
|
42
28
|
end
|
43
29
|
|
44
30
|
end
|
data/lib/towsta/vertical.rb
CHANGED
@@ -14,9 +14,10 @@ module Towsta
|
|
14
14
|
puts " class #{args[:name]} was created"
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.populate classname, horizontals, occurrences = []
|
17
|
+
def self.populate classname, horizontals, count, occurrences = []
|
18
18
|
klass = Kernel.const_get classname.to_s
|
19
19
|
klass.all = []
|
20
|
+
klass.count = count
|
20
21
|
horizontals.each {|horizontal| klass.new(horizontal)}
|
21
22
|
occurrences.each {|occurrence| klass.add_occurrence(occurrence)}
|
22
23
|
puts " class #{classname} was populated with #{horizontals.size} instances"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 2.0.
|
8
|
+
- 6
|
9
|
+
version: 2.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mortaro
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-02-
|
17
|
+
date: 2012-02-16 00:00:00 -02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -267,6 +267,8 @@ files:
|
|
267
267
|
- lib/towsta/sinatra_extension.rb
|
268
268
|
- lib/towsta/synchronizer.rb
|
269
269
|
- lib/towsta/version.rb
|
270
|
+
- lib/towsta/vertical-core/.attributes.rb.swn
|
271
|
+
- lib/towsta/vertical-core/.references.rb.swn
|
270
272
|
- lib/towsta/vertical-core/attributes.rb
|
271
273
|
- lib/towsta/vertical-core/base.rb
|
272
274
|
- lib/towsta/vertical-core/crud.rb
|