towsta 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/towsta/version.rb +1 -1
- data/lib/towsta/vertical.rb +3 -6
- metadata +3 -3
data/lib/towsta/version.rb
CHANGED
data/lib/towsta/vertical.rb
CHANGED
@@ -15,7 +15,7 @@ module Towsta
|
|
15
15
|
klass = Class.new do
|
16
16
|
|
17
17
|
class << self
|
18
|
-
attr_accessor :all, :attributes
|
18
|
+
attr_accessor :all, :attributes, :count
|
19
19
|
end
|
20
20
|
|
21
21
|
args[:slices].each do |attr, kind|
|
@@ -25,10 +25,6 @@ module Towsta
|
|
25
25
|
eval "def self.find_all_by_#{attr} value; #{Vertical.parse_find_all attr, kind}; end;"
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.count
|
29
|
-
self.all.size
|
30
|
-
end
|
31
|
-
|
32
28
|
def self.first
|
33
29
|
self.all.first
|
34
30
|
end
|
@@ -123,6 +119,7 @@ module Towsta
|
|
123
119
|
|
124
120
|
end
|
125
121
|
klass.all = []
|
122
|
+
klass.count = args[:count]
|
126
123
|
klass.attributes = args[:slices].keys
|
127
124
|
Object.const_set args[:name], klass
|
128
125
|
end
|
@@ -134,7 +131,7 @@ module Towsta
|
|
134
131
|
end
|
135
132
|
|
136
133
|
def self.parse_set attr, kind
|
137
|
-
return "@#{attr} =
|
134
|
+
return "@#{attr} = \"\#{value.to_s}\"" if ['main','text','formated','password','link'].include? kind
|
138
135
|
return "@#{attr} = value.to_f;" if kind == 'money'
|
139
136
|
return "@#{attr} = value.to_i;" if kind == 'integer'
|
140
137
|
return "@#{attr} = value == '1';" if kind == 'boolean'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 9
|
9
|
+
version: 0.3.9
|
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: 2011-05-
|
17
|
+
date: 2011-05-10 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|