lafcadio 0.4.3 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/bin/lafcadio_schema +28 -0
  2. data/lib/lafcadio.rb +3 -4
  3. data/lib/lafcadio.rb~ +3 -4
  4. data/lib/lafcadio/TestSuite.rb +2 -0
  5. data/lib/lafcadio/TestSuite.rb~ +16 -0
  6. data/lib/lafcadio/dateTime.rb +93 -2
  7. data/lib/lafcadio/{dateTime/Month.rb → dateTime.rb~} +33 -33
  8. data/lib/lafcadio/depend.rb +3 -0
  9. data/lib/lafcadio/domain.rb +574 -70
  10. data/lib/lafcadio/domain.rb~ +570 -70
  11. data/lib/lafcadio/mock.rb +92 -2
  12. data/lib/lafcadio/mock.rb~ +93 -0
  13. data/lib/lafcadio/objectField.rb +614 -3
  14. data/lib/lafcadio/objectField.rb~ +618 -0
  15. data/lib/lafcadio/objectStore.rb +662 -19
  16. data/lib/lafcadio/objectStore.rb~ +746 -0
  17. data/lib/lafcadio/query.rb +415 -31
  18. data/lib/lafcadio/query.rb~ +572 -0
  19. data/lib/lafcadio/schema.rb +57 -2
  20. data/lib/lafcadio/test.rb +17 -2
  21. data/lib/lafcadio/{test/LafcadioTestCase.rb → test.rb~} +5 -5
  22. data/lib/lafcadio/test/testconfig.dat +1 -1
  23. data/lib/lafcadio/util.rb +337 -20
  24. metadata +16 -77
  25. data/lib/lafcadio/domain/DomainObject.rb +0 -375
  26. data/lib/lafcadio/domain/DomainObject.rb~ +0 -371
  27. data/lib/lafcadio/domain/MapObject.rb +0 -22
  28. data/lib/lafcadio/domain/ObjectType.rb +0 -80
  29. data/lib/lafcadio/includer.rb +0 -18
  30. data/lib/lafcadio/mock/MockDbBridge.rb +0 -78
  31. data/lib/lafcadio/mock/MockDbBridge.rb~ +0 -74
  32. data/lib/lafcadio/mock/MockObjectStore.rb +0 -20
  33. data/lib/lafcadio/objectField/AutoIncrementField.rb +0 -25
  34. data/lib/lafcadio/objectField/BooleanField.rb +0 -83
  35. data/lib/lafcadio/objectField/DateField.rb +0 -33
  36. data/lib/lafcadio/objectField/DateTimeField.rb +0 -25
  37. data/lib/lafcadio/objectField/DecimalField.rb +0 -41
  38. data/lib/lafcadio/objectField/EmailField.rb +0 -28
  39. data/lib/lafcadio/objectField/EnumField.rb +0 -62
  40. data/lib/lafcadio/objectField/FieldValueError.rb +0 -4
  41. data/lib/lafcadio/objectField/IntegerField.rb +0 -15
  42. data/lib/lafcadio/objectField/LinkField.rb +0 -92
  43. data/lib/lafcadio/objectField/LinkField.rb~ +0 -86
  44. data/lib/lafcadio/objectField/MoneyField.rb +0 -13
  45. data/lib/lafcadio/objectField/MonthField.rb +0 -16
  46. data/lib/lafcadio/objectField/ObjectField.rb +0 -142
  47. data/lib/lafcadio/objectField/PasswordField.rb +0 -29
  48. data/lib/lafcadio/objectField/StateField.rb +0 -13
  49. data/lib/lafcadio/objectField/SubsetLinkField.rb +0 -25
  50. data/lib/lafcadio/objectField/TextField.rb +0 -23
  51. data/lib/lafcadio/objectField/TextListField.rb +0 -21
  52. data/lib/lafcadio/objectField/TimeStampField.rb +0 -15
  53. data/lib/lafcadio/objectStore/Cache.rb +0 -81
  54. data/lib/lafcadio/objectStore/Committer.rb +0 -65
  55. data/lib/lafcadio/objectStore/CouldntMatchObjectTypeError.rb +0 -4
  56. data/lib/lafcadio/objectStore/DbBridge.rb +0 -140
  57. data/lib/lafcadio/objectStore/DbBridge.rb~ +0 -140
  58. data/lib/lafcadio/objectStore/DomainComparable.rb +0 -25
  59. data/lib/lafcadio/objectStore/DomainObjectInitError.rb +0 -9
  60. data/lib/lafcadio/objectStore/DomainObjectNotFoundError.rb +0 -4
  61. data/lib/lafcadio/objectStore/DomainObjectProxy.rb +0 -62
  62. data/lib/lafcadio/objectStore/DomainObjectSqlMaker.rb +0 -74
  63. data/lib/lafcadio/objectStore/ObjectStore.rb +0 -207
  64. data/lib/lafcadio/objectStore/ObjectStore.rb~ +0 -207
  65. data/lib/lafcadio/objectStore/SqlValueConverter.rb +0 -30
  66. data/lib/lafcadio/objectStore/SqlValueConverter.rb~ +0 -30
  67. data/lib/lafcadio/query/Compare.rb +0 -55
  68. data/lib/lafcadio/query/CompoundCondition.rb +0 -39
  69. data/lib/lafcadio/query/Condition.rb +0 -66
  70. data/lib/lafcadio/query/Condition.rb~ +0 -66
  71. data/lib/lafcadio/query/Equals.rb +0 -45
  72. data/lib/lafcadio/query/In.rb +0 -20
  73. data/lib/lafcadio/query/Like.rb +0 -48
  74. data/lib/lafcadio/query/Link.rb +0 -20
  75. data/lib/lafcadio/query/Max.rb +0 -32
  76. data/lib/lafcadio/query/Max.rb~ +0 -25
  77. data/lib/lafcadio/query/Not.rb +0 -21
  78. data/lib/lafcadio/query/Query.rb +0 -92
  79. data/lib/lafcadio/schema/CreateTableStatement.rb +0 -61
  80. data/lib/lafcadio/schema/CreateTableStatement.rb~ +0 -59
  81. data/lib/lafcadio/util/Context.rb +0 -61
  82. data/lib/lafcadio/util/ContextualService.rb +0 -33
  83. data/lib/lafcadio/util/English.rb +0 -117
  84. data/lib/lafcadio/util/HashOfArrays.rb +0 -48
  85. data/lib/lafcadio/util/LafcadioConfig.rb +0 -25
  86. data/lib/lafcadio/util/QueueHash.rb +0 -67
  87. data/lib/lafcadio/util/UsStates.rb +0 -29
  88. 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
@@ -1,2 +0,0 @@
1
- require 'lafcadio/includer'
2
- Includer.include( 'xml' )