lafcadio 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lafcadio.rb +1 -1
- data/lib/lafcadio.rb~ +1 -1
- data/lib/lafcadio/domain.rb +363 -255
- data/lib/lafcadio/domain.rb~ +201 -230
- data/lib/lafcadio/mock.rb +64 -70
- data/lib/lafcadio/mock.rb~ +48 -49
- data/lib/lafcadio/objectField.rb +137 -127
- data/lib/lafcadio/objectField.rb~ +7 -7
- data/lib/lafcadio/objectStore.rb +560 -586
- data/lib/lafcadio/objectStore.rb~ +495 -536
- data/lib/lafcadio/query.rb +320 -213
- data/lib/lafcadio/query.rb~ +129 -131
- data/lib/lafcadio/schema.rb +10 -14
- data/lib/lafcadio/schema.rb~ +1 -1
- data/lib/lafcadio/test.rb +174 -75
- data/lib/lafcadio/test.rb~ +191 -0
- data/lib/lafcadio/util.rb +1 -32
- data/lib/lafcadio/util.rb~ +1 -6
- metadata +2 -2
data/lib/lafcadio/util.rb
CHANGED
@@ -33,8 +33,7 @@ module Lafcadio
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
class MissingError < RuntimeError
|
37
|
-
end
|
36
|
+
class MissingError < RuntimeError; end
|
38
37
|
end
|
39
38
|
|
40
39
|
class String
|
@@ -47,36 +46,6 @@ class String
|
|
47
46
|
|
48
47
|
end
|
49
48
|
|
50
|
-
# Returns the number of times that <tt>regexp</tt> occurs in the string.
|
51
|
-
def count_occurrences(regexp)
|
52
|
-
count = 0
|
53
|
-
str = self.clone
|
54
|
-
while str =~ regexp
|
55
|
-
count += 1
|
56
|
-
str = $'
|
57
|
-
end
|
58
|
-
count
|
59
|
-
end
|
60
|
-
|
61
|
-
# Decapitalizes the first letter of the string, or decapitalizes the
|
62
|
-
# entire string if it's all capitals.
|
63
|
-
#
|
64
|
-
# 'InternalClient'.decapitalize -> "internalClient"
|
65
|
-
# 'SKU'.decapitalize -> "sku"
|
66
|
-
def decapitalize
|
67
|
-
string = clone
|
68
|
-
firstLetter = string[0..0].downcase
|
69
|
-
string = firstLetter + string[1..string.length]
|
70
|
-
newString = ""
|
71
|
-
while string =~ /([A-Z])([^a-z]|$)/
|
72
|
-
newString += $`
|
73
|
-
newString += $1.downcase
|
74
|
-
string = $2 + $'
|
75
|
-
end
|
76
|
-
newString += string
|
77
|
-
newString
|
78
|
-
end
|
79
|
-
|
80
49
|
# Left-pads a string with +fillChar+ up to +size+ size.
|
81
50
|
#
|
82
51
|
# "a".pad( 10, "+") -> "+++++++++a"
|
data/lib/lafcadio/util.rb~
CHANGED
@@ -22,18 +22,13 @@ module Lafcadio
|
|
22
22
|
def self.set_values( value_hash ); @@value_hash = value_hash; end
|
23
23
|
|
24
24
|
def initialize
|
25
|
-
#puts "initialize " + @@filename.inspect
|
26
25
|
if @@value_hash
|
27
26
|
@@value_hash.each { |key, value| self[key] = value }
|
28
|
-
|
29
|
-
else
|
30
|
-
#puts caller.inspect
|
27
|
+
elsif @@filename
|
31
28
|
File.new( @@filename ).each_line { |line|
|
32
29
|
line.chomp =~ /^(.*?):(.*)$/
|
33
30
|
self[$1] = $2
|
34
31
|
}
|
35
|
-
# else
|
36
|
-
# raise
|
37
32
|
end
|
38
33
|
end
|
39
34
|
end
|
metadata
CHANGED