towsta 0.2.6 → 0.2.7
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 +6 -1
- metadata +2 -2
data/lib/towsta/version.rb
CHANGED
data/lib/towsta/vertical.rb
CHANGED
@@ -76,6 +76,11 @@ module Towsta
|
|
76
76
|
response
|
77
77
|
end
|
78
78
|
|
79
|
+
def self.random
|
80
|
+
position = (self.all.size) - 1
|
81
|
+
self.all[rand(position)]
|
82
|
+
end
|
83
|
+
|
79
84
|
def self.create args
|
80
85
|
self.new(args.merge(:id => nil)).save
|
81
86
|
end
|
@@ -107,7 +112,7 @@ module Towsta
|
|
107
112
|
end
|
108
113
|
|
109
114
|
def self.parse_set attr, kind
|
110
|
-
return "@#{attr} = value
|
115
|
+
return "@#{attr} = \"\#{value.to_s}\"" if ['main','text','formated','password','link'].include? kind
|
111
116
|
return "@#{attr} = value.to_f;" if kind == 'money'
|
112
117
|
return "@#{attr} = value.to_i;" if kind == 'integer'
|
113
118
|
return "@#{attr} = value == '1';" if kind == 'boolean'
|