towsta 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Towsta
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -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;" if ['main','text','formated','password','link'].include? kind
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'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 6
9
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mortaro