lafcadio 0.4.3 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/lafcadio_schema +28 -0
- data/lib/lafcadio.rb +3 -4
- data/lib/lafcadio.rb~ +3 -4
- data/lib/lafcadio/TestSuite.rb +2 -0
- data/lib/lafcadio/TestSuite.rb~ +16 -0
- data/lib/lafcadio/dateTime.rb +93 -2
- data/lib/lafcadio/{dateTime/Month.rb → dateTime.rb~} +33 -33
- data/lib/lafcadio/depend.rb +3 -0
- data/lib/lafcadio/domain.rb +574 -70
- data/lib/lafcadio/domain.rb~ +570 -70
- data/lib/lafcadio/mock.rb +92 -2
- data/lib/lafcadio/mock.rb~ +93 -0
- data/lib/lafcadio/objectField.rb +614 -3
- data/lib/lafcadio/objectField.rb~ +618 -0
- data/lib/lafcadio/objectStore.rb +662 -19
- data/lib/lafcadio/objectStore.rb~ +746 -0
- data/lib/lafcadio/query.rb +415 -31
- data/lib/lafcadio/query.rb~ +572 -0
- data/lib/lafcadio/schema.rb +57 -2
- data/lib/lafcadio/test.rb +17 -2
- data/lib/lafcadio/{test/LafcadioTestCase.rb → test.rb~} +5 -5
- data/lib/lafcadio/test/testconfig.dat +1 -1
- data/lib/lafcadio/util.rb +337 -20
- metadata +16 -77
- data/lib/lafcadio/domain/DomainObject.rb +0 -375
- data/lib/lafcadio/domain/DomainObject.rb~ +0 -371
- data/lib/lafcadio/domain/MapObject.rb +0 -22
- data/lib/lafcadio/domain/ObjectType.rb +0 -80
- data/lib/lafcadio/includer.rb +0 -18
- data/lib/lafcadio/mock/MockDbBridge.rb +0 -78
- data/lib/lafcadio/mock/MockDbBridge.rb~ +0 -74
- data/lib/lafcadio/mock/MockObjectStore.rb +0 -20
- data/lib/lafcadio/objectField/AutoIncrementField.rb +0 -25
- data/lib/lafcadio/objectField/BooleanField.rb +0 -83
- data/lib/lafcadio/objectField/DateField.rb +0 -33
- data/lib/lafcadio/objectField/DateTimeField.rb +0 -25
- data/lib/lafcadio/objectField/DecimalField.rb +0 -41
- data/lib/lafcadio/objectField/EmailField.rb +0 -28
- data/lib/lafcadio/objectField/EnumField.rb +0 -62
- data/lib/lafcadio/objectField/FieldValueError.rb +0 -4
- data/lib/lafcadio/objectField/IntegerField.rb +0 -15
- data/lib/lafcadio/objectField/LinkField.rb +0 -92
- data/lib/lafcadio/objectField/LinkField.rb~ +0 -86
- data/lib/lafcadio/objectField/MoneyField.rb +0 -13
- data/lib/lafcadio/objectField/MonthField.rb +0 -16
- data/lib/lafcadio/objectField/ObjectField.rb +0 -142
- data/lib/lafcadio/objectField/PasswordField.rb +0 -29
- data/lib/lafcadio/objectField/StateField.rb +0 -13
- data/lib/lafcadio/objectField/SubsetLinkField.rb +0 -25
- data/lib/lafcadio/objectField/TextField.rb +0 -23
- data/lib/lafcadio/objectField/TextListField.rb +0 -21
- data/lib/lafcadio/objectField/TimeStampField.rb +0 -15
- data/lib/lafcadio/objectStore/Cache.rb +0 -81
- data/lib/lafcadio/objectStore/Committer.rb +0 -65
- data/lib/lafcadio/objectStore/CouldntMatchObjectTypeError.rb +0 -4
- data/lib/lafcadio/objectStore/DbBridge.rb +0 -140
- data/lib/lafcadio/objectStore/DbBridge.rb~ +0 -140
- data/lib/lafcadio/objectStore/DomainComparable.rb +0 -25
- data/lib/lafcadio/objectStore/DomainObjectInitError.rb +0 -9
- data/lib/lafcadio/objectStore/DomainObjectNotFoundError.rb +0 -4
- data/lib/lafcadio/objectStore/DomainObjectProxy.rb +0 -62
- data/lib/lafcadio/objectStore/DomainObjectSqlMaker.rb +0 -74
- data/lib/lafcadio/objectStore/ObjectStore.rb +0 -207
- data/lib/lafcadio/objectStore/ObjectStore.rb~ +0 -207
- data/lib/lafcadio/objectStore/SqlValueConverter.rb +0 -30
- data/lib/lafcadio/objectStore/SqlValueConverter.rb~ +0 -30
- data/lib/lafcadio/query/Compare.rb +0 -55
- data/lib/lafcadio/query/CompoundCondition.rb +0 -39
- data/lib/lafcadio/query/Condition.rb +0 -66
- data/lib/lafcadio/query/Condition.rb~ +0 -66
- data/lib/lafcadio/query/Equals.rb +0 -45
- data/lib/lafcadio/query/In.rb +0 -20
- data/lib/lafcadio/query/Like.rb +0 -48
- data/lib/lafcadio/query/Link.rb +0 -20
- data/lib/lafcadio/query/Max.rb +0 -32
- data/lib/lafcadio/query/Max.rb~ +0 -25
- data/lib/lafcadio/query/Not.rb +0 -21
- data/lib/lafcadio/query/Query.rb +0 -92
- data/lib/lafcadio/schema/CreateTableStatement.rb +0 -61
- data/lib/lafcadio/schema/CreateTableStatement.rb~ +0 -59
- data/lib/lafcadio/util/Context.rb +0 -61
- data/lib/lafcadio/util/ContextualService.rb +0 -33
- data/lib/lafcadio/util/English.rb +0 -117
- data/lib/lafcadio/util/HashOfArrays.rb +0 -48
- data/lib/lafcadio/util/LafcadioConfig.rb +0 -25
- data/lib/lafcadio/util/QueueHash.rb +0 -67
- data/lib/lafcadio/util/UsStates.rb +0 -29
- data/lib/lafcadio/xml.rb +0 -2
@@ -1,48 +0,0 @@
|
|
1
|
-
module Lafcadio
|
2
|
-
class HashOfArrays #:nodoc:
|
3
|
-
def initialize
|
4
|
-
@values = {}
|
5
|
-
end
|
6
|
-
|
7
|
-
def set(key, array)
|
8
|
-
raise "HashOfArrays.[]= needs a value of type Array" if array.class != Array
|
9
|
-
@values[key] = array
|
10
|
-
end
|
11
|
-
|
12
|
-
def []=(key, array)
|
13
|
-
set key, array
|
14
|
-
end
|
15
|
-
|
16
|
-
def getArray(key)
|
17
|
-
array = @values[key]
|
18
|
-
if array == nil
|
19
|
-
array = []
|
20
|
-
@values[key] = array
|
21
|
-
end
|
22
|
-
array
|
23
|
-
end
|
24
|
-
|
25
|
-
def get(key)
|
26
|
-
array = @values[key]
|
27
|
-
array != nil ? array[0] : nil
|
28
|
-
end
|
29
|
-
|
30
|
-
def [](key)
|
31
|
-
getArray key
|
32
|
-
end
|
33
|
-
|
34
|
-
def values
|
35
|
-
values = []
|
36
|
-
@values.values.each { |val| values << val[0] }
|
37
|
-
values
|
38
|
-
end
|
39
|
-
|
40
|
-
def keys
|
41
|
-
@values.keys
|
42
|
-
end
|
43
|
-
|
44
|
-
def each
|
45
|
-
@values.each { |key, array| yield key, array }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Lafcadio
|
2
|
-
# LafcadioConfig is a Hash that takes its data from the config file. You'll
|
3
|
-
# have to set the location of that file before using it: Use
|
4
|
-
# LafcadioConfig.setFilename.
|
5
|
-
#
|
6
|
-
# LafcadioConfig expects its data to be colon-delimited, one key-value pair
|
7
|
-
# to a line. For example:
|
8
|
-
# dbuser:user
|
9
|
-
# dbpassword:password
|
10
|
-
# dbname:lafcadio_test
|
11
|
-
# dbhost:localhost
|
12
|
-
class LafcadioConfig < Hash
|
13
|
-
def LafcadioConfig.setFilename(filename)
|
14
|
-
@@filename = filename
|
15
|
-
end
|
16
|
-
|
17
|
-
def initialize
|
18
|
-
file = File.new @@filename
|
19
|
-
file.each_line { |line|
|
20
|
-
line.chomp =~ /^(.*?):(.*)$/
|
21
|
-
self[$1] = $2
|
22
|
-
}
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
module Lafcadio
|
2
|
-
# An ordered hash: Keys are ordered according to when they were inserted.
|
3
|
-
class QueueHash
|
4
|
-
# Creates a QueueHash with all the elements in <tt>array</tt> as keys, and
|
5
|
-
# each value initially set to be the same as the corresponding key.
|
6
|
-
def QueueHash.newFromArray(array)
|
7
|
-
valueArray = []
|
8
|
-
array.each { |elt|
|
9
|
-
valueArray << elt
|
10
|
-
valueArray << elt
|
11
|
-
}
|
12
|
-
new(*valueArray)
|
13
|
-
end
|
14
|
-
|
15
|
-
# Takes an even number of arguments, and sets each odd-numbered argument to
|
16
|
-
# correspond to the argument immediately afterward. For example:
|
17
|
-
# queueHash = QueueHash.new (1, 2, 3, 4)
|
18
|
-
# queueHash[1] => 2
|
19
|
-
# queueHash[3] => 4
|
20
|
-
def initialize(*values)
|
21
|
-
@pairs = []
|
22
|
-
0.step(values.size-1, 2) { |i| @pairs << [ values[i], values[i+1] ] }
|
23
|
-
end
|
24
|
-
|
25
|
-
def keys
|
26
|
-
keys = []
|
27
|
-
@pairs.each { |pair| keys << pair[0] }
|
28
|
-
keys
|
29
|
-
end
|
30
|
-
|
31
|
-
def values
|
32
|
-
values = []
|
33
|
-
@pairs.each { |pair| values << pair[1] }
|
34
|
-
values
|
35
|
-
end
|
36
|
-
|
37
|
-
def [](key)
|
38
|
-
value = nil
|
39
|
-
@pairs.each { |pair| value = pair[1] if pair[0] == key }
|
40
|
-
value
|
41
|
-
end
|
42
|
-
|
43
|
-
def size
|
44
|
-
@pairs.size
|
45
|
-
end
|
46
|
-
|
47
|
-
def []=(key, value)
|
48
|
-
@pairs << [key, value]
|
49
|
-
end
|
50
|
-
|
51
|
-
def each
|
52
|
-
@pairs.each { |pair| yield pair[0], pair[1] }
|
53
|
-
end
|
54
|
-
|
55
|
-
def ==( otherObj )
|
56
|
-
if otherObj.class == QueueHash && otherObj.size == size
|
57
|
-
match = true
|
58
|
-
(0...size).each { |i|
|
59
|
-
match &&= keys[i] == otherObj.keys[i] && values[i] == otherObj.values[i]
|
60
|
-
}
|
61
|
-
match
|
62
|
-
else
|
63
|
-
false
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Lafcadio
|
2
|
-
class UsStates
|
3
|
-
# Returns a QueueHash of states, with two-letter postal codes as keys and
|
4
|
-
# state names as values.
|
5
|
-
def UsStates.states
|
6
|
-
require 'lafcadio/util/QueueHash'
|
7
|
-
QueueHash.new( 'AL', 'Alabama', 'AK', 'Alaska', 'AZ', 'Arizona',
|
8
|
-
'AR', 'Arkansas', 'CA', 'California', 'CO', 'Colorado',
|
9
|
-
'CT', 'Connecticut', 'DE', 'Delaware',
|
10
|
-
'DC', 'District of Columbia', 'FL', 'Florida',
|
11
|
-
'GA', 'Georgia', 'HI', 'Hawaii', 'ID', 'Idaho',
|
12
|
-
'IL', 'Illinois', 'IN', 'Indiana', 'IA', 'Iowa',
|
13
|
-
'KS', 'Kansas', 'KY', 'Kentucky', 'LA', 'Louisiana',
|
14
|
-
'ME', 'Maine', 'MD', 'Maryland', 'MA', 'Massachusetts',
|
15
|
-
'MI', 'Michigan', 'MN', 'Minnesota', 'MS', 'Mississippi',
|
16
|
-
'MO', 'Missouri', 'MT', 'Montana', 'NE', 'Nebraska',
|
17
|
-
'NV', 'Nevada', 'NH', 'New Hampshire',
|
18
|
-
'NJ', 'New Jersey', 'NM', 'New Mexico', 'NY', 'New York',
|
19
|
-
'NC', 'North Carolina', 'ND', 'North Dakota',
|
20
|
-
'OH', 'Ohio', 'OK', 'Oklahoma', 'OR', 'Oregon',
|
21
|
-
'PA', 'Pennsylvania', 'PR', 'Puerto Rico',
|
22
|
-
'RI', 'Rhode Island', 'SC', 'South Carolina',
|
23
|
-
'SD', 'South Dakota', 'TN', 'Tennessee', 'TX', 'Texas',
|
24
|
-
'UT', 'Utah', 'VT', 'Vermont', 'VA', 'Virginia',
|
25
|
-
'WA', 'Washington', 'WV', 'West Virginia',
|
26
|
-
'WI', 'Wisconsin', 'WY', 'Wyoming' )
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/lafcadio/xml.rb
DELETED