dm-types 1.0.0.rc3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -71,7 +71,7 @@
71
71
  source 'http://rubygems.org'
72
72
 
73
73
  DATAMAPPER = 'git://github.com/datamapper'
74
- DM_VERSION = '~> 1.0.0.rc3'
74
+ DM_VERSION = '~> 1.0.0'
75
75
 
76
76
  group :runtime do # Runtime dependencies (as in the gemspec)
77
77
 
data/Rakefile CHANGED
@@ -15,14 +15,14 @@ begin
15
15
 
16
16
  gem.rubyforge_project = 'datamapper'
17
17
 
18
- gem.add_dependency 'dm-core', '~> 1.0.0.rc3'
18
+ gem.add_dependency 'dm-core', '~> 1.0.0'
19
19
  gem.add_dependency 'fastercsv', '~> 1.5.3'
20
20
  gem.add_dependency 'json_pure', '~> 1.4.3'
21
21
  gem.add_dependency 'uuidtools', '~> 2.1.1'
22
22
  gem.add_dependency 'stringex', '~> 1.1.0'
23
23
 
24
24
  gem.add_development_dependency 'rspec', '~> 1.3'
25
- gem.add_development_dependency 'dm-validations', '~> 1.0.0.rc3'
25
+ gem.add_development_dependency 'dm-validations', '~> 1.0.0'
26
26
  end
27
27
 
28
28
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.rc3
1
+ 1.0.0
data/dm-types.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dm-types}
8
- s.version = "1.0.0.rc3"
8
+ s.version = "1.0.0"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Kubb"]
12
- s.date = %q{2010-05-27}
12
+ s.date = %q{2010-06-08}
13
13
  s.description = %q{DataMapper plugin providing extra data types}
14
14
  s.email = %q{dan.kubb [a] gmail [d] com}
15
15
  s.extra_rdoc_files = [
@@ -133,30 +133,30 @@ Gem::Specification.new do |s|
133
133
  s.specification_version = 3
134
134
 
135
135
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
136
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
136
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0"])
137
137
  s.add_runtime_dependency(%q<fastercsv>, ["~> 1.5.3"])
138
138
  s.add_runtime_dependency(%q<json_pure>, ["~> 1.4.3"])
139
139
  s.add_runtime_dependency(%q<uuidtools>, ["~> 2.1.1"])
140
140
  s.add_runtime_dependency(%q<stringex>, ["~> 1.1.0"])
141
141
  s.add_development_dependency(%q<rspec>, ["~> 1.3"])
142
- s.add_development_dependency(%q<dm-validations>, ["~> 1.0.0.rc3"])
142
+ s.add_development_dependency(%q<dm-validations>, ["~> 1.0.0"])
143
143
  else
144
- s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
144
+ s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
145
145
  s.add_dependency(%q<fastercsv>, ["~> 1.5.3"])
146
146
  s.add_dependency(%q<json_pure>, ["~> 1.4.3"])
147
147
  s.add_dependency(%q<uuidtools>, ["~> 2.1.1"])
148
148
  s.add_dependency(%q<stringex>, ["~> 1.1.0"])
149
149
  s.add_dependency(%q<rspec>, ["~> 1.3"])
150
- s.add_dependency(%q<dm-validations>, ["~> 1.0.0.rc3"])
150
+ s.add_dependency(%q<dm-validations>, ["~> 1.0.0"])
151
151
  end
152
152
  else
153
- s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
153
+ s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
154
154
  s.add_dependency(%q<fastercsv>, ["~> 1.5.3"])
155
155
  s.add_dependency(%q<json_pure>, ["~> 1.4.3"])
156
156
  s.add_dependency(%q<uuidtools>, ["~> 2.1.1"])
157
157
  s.add_dependency(%q<stringex>, ["~> 1.1.0"])
158
158
  s.add_dependency(%q<rspec>, ["~> 1.3"])
159
- s.add_dependency(%q<dm-validations>, ["~> 1.0.0.rc3"])
159
+ s.add_dependency(%q<dm-validations>, ["~> 1.0.0"])
160
160
  end
161
161
  end
162
162
 
data/lib/dm-types/csv.rb CHANGED
@@ -10,6 +10,10 @@ end
10
10
  module DataMapper
11
11
  class Property
12
12
  class Csv < Text
13
+ def primitive?(value)
14
+ super || value.kind_of?(::Array)
15
+ end
16
+
13
17
  def load(value)
14
18
  case value
15
19
  when ::String then CSV.parse(value)
data/lib/dm-types/flag.rb CHANGED
@@ -53,8 +53,8 @@ module DataMapper
53
53
  def typecast(value)
54
54
  case value
55
55
  when nil then nil
56
- when Array then value.map {|v| v.to_sym}
57
- else value.to_sym
56
+ when ::Array then value.map {|v| v.to_sym}
57
+ else [value.to_sym]
58
58
  end
59
59
  end
60
60
  end # class Flag
@@ -19,7 +19,7 @@ module DataMapper
19
19
  property :picture, Enum[:octocat, :fork_you, :git_down]
20
20
 
21
21
  property :color, Enum[:white, :black, :red, :orange, :yellow, :green, :cyan, :blue, :purple]
22
- property :size, Flag[:xs, :small, :medium, :large, :xl, :xxl]
22
+ property :size, Flag[:xs, :small, :medium, :large, :xl, :xxl], :default => :xs
23
23
  end # Shirt
24
24
  end # Fixtures
25
25
  end # Types
@@ -11,14 +11,20 @@ try_spec do
11
11
  :writing => 'Fork you',
12
12
  :has_picture => true,
13
13
  :picture => :octocat,
14
- :color => :white,
15
- :size => [ :xs, :medium ]
14
+ :color => :white
16
15
  )
17
16
  end
18
17
 
18
+ describe 'with the default value' do
19
+ it 'returns it as an array' do
20
+ @resource.size.should eql([DataMapper::Types::Fixtures::TShirt.properties[:size].default])
21
+ end
22
+ end
23
+
19
24
  describe 'with multiple sizes' do
20
25
  describe 'dumped and loaded' do
21
26
  before do
27
+ @resource.size = [ :xs, :medium ]
22
28
  @resource.save.should be(true)
23
29
  @resource.reload
24
30
  end
@@ -79,6 +79,17 @@ try_spec do
79
79
  @result.should be_nil
80
80
  end
81
81
  end
82
+
83
+ describe 'when argument is an array' do
84
+ before :all do
85
+ @input = [ 1, 2, 3 ]
86
+ @result = @property.load(@input)
87
+ end
88
+
89
+ it 'returns input as is' do
90
+ @result.should eql(@input)
91
+ end
92
+ end
82
93
  end
83
94
 
84
95
  describe '.dump' do
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-types
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940572
5
- prerelease: true
4
+ hash: 23
5
+ prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - rc3
11
- version: 1.0.0.rc3
10
+ version: 1.0.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Dan Kubb
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-05-27 00:00:00 -07:00
18
+ date: 2010-06-08 00:00:00 -07:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -27,13 +26,12 @@ dependencies:
27
26
  requirements:
28
27
  - - ~>
29
28
  - !ruby/object:Gem::Version
30
- hash: 977940572
29
+ hash: 23
31
30
  segments:
32
31
  - 1
33
32
  - 0
34
33
  - 0
35
- - rc3
36
- version: 1.0.0.rc3
34
+ version: 1.0.0
37
35
  type: :runtime
38
36
  version_requirements: *id001
39
37
  - !ruby/object:Gem::Dependency
@@ -123,13 +121,12 @@ dependencies:
123
121
  requirements:
124
122
  - - ~>
125
123
  - !ruby/object:Gem::Version
126
- hash: 977940572
124
+ hash: 23
127
125
  segments:
128
126
  - 1
129
127
  - 0
130
128
  - 0
131
- - rc3
132
- version: 1.0.0.rc3
129
+ version: 1.0.0
133
130
  type: :development
134
131
  version_requirements: *id007
135
132
  description: DataMapper plugin providing extra data types
@@ -230,14 +227,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
230
227
  required_rubygems_version: !ruby/object:Gem::Requirement
231
228
  none: false
232
229
  requirements:
233
- - - ">"
230
+ - - ">="
234
231
  - !ruby/object:Gem::Version
235
- hash: 25
232
+ hash: 3
236
233
  segments:
237
- - 1
238
- - 3
239
- - 1
240
- version: 1.3.1
234
+ - 0
235
+ version: "0"
241
236
  requirements: []
242
237
 
243
238
  rubyforge_project: datamapper