doodle 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +36 -0
- data/examples/event-location.rb +47 -3
- data/examples/event.rb +30 -21
- data/examples/example-01.rb +1 -0
- data/examples/example-01.rdoc +3 -2
- data/examples/example-02.rb +1 -0
- data/examples/example-02.rdoc +2 -1
- data/examples/example-03.rb +45 -0
- data/examples/example-03.rdoc +55 -0
- data/lib/doodle.rb +220 -186
- data/lib/semantic.cache +8 -0
- data/spec/bugs_spec.rb +1 -1
- data/spec/class_spec.rb +2 -2
- data/spec/collector_spec.rb +49 -1
- data/spec/conversion_spec.rb +0 -8
- data/spec/doodle_context_spec.rb +46 -0
- data/spec/doodle_spec.rb +3 -3
- data/spec/extra_args_spec.rb +20 -0
- data/spec/factory_spec.rb +80 -0
- data/spec/init_spec.rb +60 -6
- data/spec/serialization_spec.rb +7 -2
- data/spec/singleton_spec.rb +63 -0
- metadata +22 -18
- data/examples/event1.rb +0 -33
- data/examples/event2.rb +0 -21
- data/examples/src/sequel_core-1.3/lib/sequel_core/exceptions.rb +0 -48
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doodle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean O'Halpin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-04-12 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -26,15 +26,15 @@ extra_rdoc_files:
|
|
26
26
|
files:
|
27
27
|
- lib/doodle.rb
|
28
28
|
- lib/molic_orderedhash.rb
|
29
|
-
-
|
30
|
-
- examples/
|
31
|
-
- examples/event1.rb
|
32
|
-
- examples/event2.rb
|
33
|
-
- examples/example-01.rb
|
29
|
+
- lib/semantic.cache
|
30
|
+
- examples/example-03.rb
|
34
31
|
- examples/example-01.rdoc
|
32
|
+
- examples/example-03.rdoc
|
33
|
+
- examples/event-location.rb
|
35
34
|
- examples/example-02.rb
|
35
|
+
- examples/event.rb
|
36
36
|
- examples/example-02.rdoc
|
37
|
-
- examples/
|
37
|
+
- examples/example-01.rb
|
38
38
|
- README
|
39
39
|
- COPYING
|
40
40
|
- ChangeLog
|
@@ -60,22 +60,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements: []
|
61
61
|
|
62
62
|
rubyforge_project: doodle
|
63
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.1.1
|
64
64
|
signing_key:
|
65
65
|
specification_version: 2
|
66
66
|
summary: Declarative attribute definitions, validations and conversions
|
67
67
|
test_files:
|
68
|
-
- spec/arg_order_spec.rb
|
69
|
-
- spec/attributes_spec.rb
|
70
68
|
- spec/bugs_spec.rb
|
71
|
-
- spec/
|
72
|
-
- spec/collector_spec.rb
|
73
|
-
- spec/conversion_spec.rb
|
74
|
-
- spec/defaults_spec.rb
|
75
|
-
- spec/doodle_spec.rb
|
69
|
+
- spec/factory_spec.rb
|
76
70
|
- spec/flatten_first_level_spec.rb
|
77
|
-
- spec/
|
78
|
-
- spec/
|
71
|
+
- spec/attributes_spec.rb
|
72
|
+
- spec/arg_order_spec.rb
|
79
73
|
- spec/serialization_spec.rb
|
74
|
+
- spec/singleton_spec.rb
|
80
75
|
- spec/superclass_spec.rb
|
76
|
+
- spec/init_spec.rb
|
81
77
|
- spec/validation_spec.rb
|
78
|
+
- spec/class_spec.rb
|
79
|
+
- spec/extra_args_spec.rb
|
80
|
+
- spec/collector_spec.rb
|
81
|
+
- spec/required_spec.rb
|
82
|
+
- spec/defaults_spec.rb
|
83
|
+
- spec/conversion_spec.rb
|
84
|
+
- spec/doodle_spec.rb
|
85
|
+
- spec/doodle_context_spec.rb
|
data/examples/event1.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'date'
|
2
|
-
require 'pp'
|
3
|
-
require 'doodle'
|
4
|
-
|
5
|
-
class Location < Doodle::Base
|
6
|
-
has :name, :kind => String
|
7
|
-
has :events, :init => [], :collect => :Event # forward reference, so use symbol
|
8
|
-
end
|
9
|
-
|
10
|
-
class Event < Doodle::Base
|
11
|
-
has :name, :kind => String
|
12
|
-
has :date do
|
13
|
-
kind Date
|
14
|
-
default { Date.today }
|
15
|
-
must 'be >= today' do |value|
|
16
|
-
value >= Date.today
|
17
|
-
end
|
18
|
-
from String do |s|
|
19
|
-
Date.parse(s)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
has :locations, :init => [], :collect => {:place => "Location"}
|
23
|
-
end
|
24
|
-
|
25
|
-
event = Event "Festival" do
|
26
|
-
date '2008-04-01'
|
27
|
-
place "The muddy field"
|
28
|
-
place "Beer tent" do
|
29
|
-
event "Drinking"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
pp event
|
data/examples/event2.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'date'
|
2
|
-
require 'doodle'
|
3
|
-
|
4
|
-
class Event < Doodle::Base
|
5
|
-
has :start_date, :kind => Date do
|
6
|
-
from String do |value|
|
7
|
-
Date.parse(value)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
has :end_date, :kind => Date do
|
11
|
-
from String do |value|
|
12
|
-
Date.parse(value)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
event = Event '2008-03-05', '2008-03-06'
|
17
|
-
event.start_date.to_s # => "2008-03-05"
|
18
|
-
event.end_date.to_s # => "2008-03-06"
|
19
|
-
event.start_date = '2001-01-01'
|
20
|
-
event.start_date # => #<Date: 4903821/2,0,2299161>
|
21
|
-
event.start_date.to_s # => "2001-01-01"
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Sequel
|
2
|
-
# Represents an error raised in Sequel code.
|
3
|
-
class Error < StandardError
|
4
|
-
|
5
|
-
# Error raised when an invalid statement is executed.
|
6
|
-
class InvalidStatement < Error; end
|
7
|
-
|
8
|
-
# Rollback is a special error used to rollback a transactions.
|
9
|
-
# A transaction block will catch this error and wont pass further up the stack.
|
10
|
-
class Rollback < Error ; end
|
11
|
-
|
12
|
-
# Represents an invalid value stored in the database.
|
13
|
-
class InvalidValue < Error ; end
|
14
|
-
|
15
|
-
# Represents an Invalid transform.
|
16
|
-
class InvalidTransform < Error ; end
|
17
|
-
|
18
|
-
# Represents an Invalid filter.
|
19
|
-
class InvalidFilter < Error ; end
|
20
|
-
|
21
|
-
class InvalidExpression < Error; end
|
22
|
-
|
23
|
-
# Represents an attempt to performing filter operations when no filter has been specified yet.
|
24
|
-
class NoExistingFilter < Error ; end
|
25
|
-
|
26
|
-
# Represents an invalid join type.
|
27
|
-
class InvalidJoinType < Error ; end
|
28
|
-
|
29
|
-
class WorkerStop < RuntimeError ; end
|
30
|
-
|
31
|
-
# Raised when Sequel is unable to load a specified adapter.
|
32
|
-
class AdapterNotFound < Error ; end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Object extensions
|
37
|
-
class Object
|
38
|
-
# Cancels the current transaction without an error:
|
39
|
-
#
|
40
|
-
# DB.tranaction do
|
41
|
-
# ...
|
42
|
-
# rollback! if failed_to_contact_client
|
43
|
-
# ...
|
44
|
-
# end
|
45
|
-
def rollback!
|
46
|
-
raise Sequel::Error::Rollback
|
47
|
-
end
|
48
|
-
end
|