dohruby 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/doh/app/init.rb CHANGED
@@ -12,6 +12,7 @@ def self.init(file_or_directory)
12
12
  find_home(File.dirname(file_or_directory))
13
13
  end
14
14
  $LOAD_PATH.push(File.join(DohApp::home, 'lib'))
15
+ $LOAD_PATH.push(DohApp::home)
15
16
  require 'doh'
16
17
  DohApp::load_config_file('system')
17
18
  DohApp::load_config_file('development_environment') unless DohApp::load_config_file('active_environment')
@@ -0,0 +1,2 @@
1
+ require 'doh/boot/find_dohruby'
2
+ require 'doh/app_no_stdio'
@@ -17,6 +17,7 @@ class BigDecimal
17
17
  self
18
18
  end
19
19
 
20
+ undef inspect
20
21
  def inspect
21
22
  to_s
22
23
  end
data/lib/doh/core/date.rb CHANGED
@@ -24,6 +24,7 @@ class Date
24
24
  result
25
25
  end
26
26
 
27
+ undef inspect
27
28
  def inspect
28
29
  strftime('%F')
29
30
  end
@@ -0,0 +1,5 @@
1
+ class Fixnum
2
+ def to_hex
3
+ "%02x" % self
4
+ end
5
+ end
@@ -70,8 +70,8 @@ class String
70
70
  #this method strips the string, then combines all whitespace > 1 character into a single space
71
71
  def normalize_all_whitespace
72
72
  result = self.strip.gsub("\n", ' ').gsub("\t", ' ')
73
- while result =~ /\s\s/
74
- result = result.gsub(' ', ' ')
73
+ while match = result.match(/\s\s/)
74
+ result = match.pre_match + ' ' + match.post_match
75
75
  end
76
76
  result
77
77
  end
data/lib/doh/core.rb CHANGED
@@ -4,5 +4,6 @@ require 'doh/core/date'
4
4
  require 'doh/core/deep_dup'
5
5
  require 'doh/core/dir'
6
6
  require 'doh/core/string'
7
+ require 'doh/core/fixnum'
7
8
  require 'doh/core/hash'
8
9
  require 'doh/core/require_local'
@@ -32,8 +32,8 @@ def self.insert(statement)
32
32
  request_handle.insert(statement)
33
33
  end
34
34
 
35
- def self.insert_hash(hash, table, ignore = false)
36
- request_handle.insert_hash(hash, table)
35
+ def self.insert_hash(hash, table, ignore = nil)
36
+ request_handle.insert_hash(hash, table, ignore)
37
37
  end
38
38
 
39
39
  def self.replace_hash(hash, table)
@@ -58,7 +58,7 @@ class Handle
58
58
  retval
59
59
  end
60
60
 
61
- def insert_hash(hash, table, ignore = false)
61
+ def insert_hash(hash, table, ignore = nil)
62
62
  if ignore then keyword = 'INSERT IGNORE' else keyword = 'INSERT' end
63
63
  insert_hash_helper(hash, table, keyword)
64
64
  end
@@ -0,0 +1,14 @@
1
+ require 'test/unit'
2
+ require 'doh/core/fixnum'
3
+
4
+ module Doh
5
+
6
+ class TC_core_fixnum < Test::Unit::TestCase
7
+ def test_to_hex
8
+ assert_equal('100', 256.to_hex)
9
+ assert_equal('ae', 174.to_hex)
10
+ assert_equal('10', 16.to_hex)
11
+ end
12
+ end
13
+
14
+ end
@@ -100,6 +100,12 @@ class TC_core_string < Test::Unit::TestCase
100
100
  assert_equal(true, " sm\n\noe ".equals_ignore_whitespace(" sm oe "))
101
101
  assert_equal(true, " s\tm\n\no e ".equals_ignore_whitespace("s m o e"))
102
102
  end
103
+
104
+ def test_normalize_all_whitespace
105
+ assert_equal("foo blah", " foo blah ".normalize_all_whitespace)
106
+ assert_equal("foo blah", " foo\t\t\t\tblah ".normalize_all_whitespace)
107
+ assert_equal("foo blah", "\r\n\t\t\tfoo\t\r\n \r\n\r\n\r\nblah\t\t\t\t".normalize_all_whitespace)
108
+ end
103
109
  end
104
110
 
105
111
  end
@@ -0,0 +1,4 @@
1
+ host: localhost
2
+ database: test
3
+ username: root
4
+ password:
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dohruby
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 3
9
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - Makani & Kem Mason
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-01 00:00:00 +12:00
18
+ date: 2010-10-26 00:00:00 +13:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -59,6 +60,7 @@ files:
59
60
  - lib/doh/app_pwd.rb
60
61
  - lib/doh/app_util.rb
61
62
  - lib/doh/boot/app.rb
63
+ - lib/doh/boot/app_no_stdio.rb
62
64
  - lib/doh/boot/app_pwd.rb
63
65
  - lib/doh/boot/find_dohruby.rb
64
66
  - lib/doh/boot/find_dohruby_18.rb
@@ -70,6 +72,7 @@ files:
70
72
  - lib/doh/core/date.rb
71
73
  - lib/doh/core/deep_dup.rb
72
74
  - lib/doh/core/dir.rb
75
+ - lib/doh/core/fixnum.rb
73
76
  - lib/doh/core/hash.rb
74
77
  - lib/doh/core/object.rb
75
78
  - lib/doh/core/require_local.rb
@@ -171,6 +174,7 @@ files:
171
174
  - test/core/tc_bigdecimal.rb
172
175
  - test/core/tc_date.rb
173
176
  - test/core/tc_deep_dup.rb
177
+ - test/core/tc_fixnum.rb
174
178
  - test/core/tc_hash.rb
175
179
  - test/core/tc_socket.rb
176
180
  - test/core/tc_string.rb
@@ -186,6 +190,7 @@ files:
186
190
  - test/mysql/001_up.sql
187
191
  - test/mysql/002_down.sql
188
192
  - test/mysql/002_up.sql
193
+ - test/mysql/connector.yml
189
194
  - test/mysql/connector.yml.tmpl
190
195
  - test/mysql/db_unit_test.rb
191
196
  - test/mysql/tc_cache_connector.rb
@@ -224,23 +229,27 @@ rdoc_options: []
224
229
  require_paths:
225
230
  - lib
226
231
  required_ruby_version: !ruby/object:Gem::Requirement
232
+ none: false
227
233
  requirements:
228
234
  - - ">="
229
235
  - !ruby/object:Gem::Version
236
+ hash: 3
230
237
  segments:
231
238
  - 0
232
239
  version: "0"
233
240
  required_rubygems_version: !ruby/object:Gem::Requirement
241
+ none: false
234
242
  requirements:
235
243
  - - ">="
236
244
  - !ruby/object:Gem::Version
245
+ hash: 3
237
246
  segments:
238
247
  - 0
239
248
  version: "0"
240
249
  requirements: []
241
250
 
242
251
  rubyforge_project: dohruby
243
- rubygems_version: 1.3.6
252
+ rubygems_version: 1.3.7
244
253
  signing_key:
245
254
  specification_version: 3
246
255
  summary: DohRuby's purpose is to make your life as a developer easier & make you more efficient in your programming.
@@ -249,6 +258,7 @@ test_files:
249
258
  - test/core/tc_bigdecimal.rb
250
259
  - test/core/tc_date.rb
251
260
  - test/core/tc_deep_dup.rb
261
+ - test/core/tc_fixnum.rb
252
262
  - test/core/tc_hash.rb
253
263
  - test/core/tc_socket.rb
254
264
  - test/core/tc_string.rb