baudelaire 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7b510d37b5bae18111e4f792b943c05c3907319
4
- data.tar.gz: 0793a8c0a45b949f1abd64521807299e6b7aff4e
3
+ metadata.gz: d440186770a571a22ed9591322a9be539af04fea
4
+ data.tar.gz: dbe373fccb619757350bff7df50bad7a56051f98
5
5
  SHA512:
6
- metadata.gz: 424d1fe62c4ad8ea156a7c827714b6ee908fe7c5836a8b1b0ffe3de43fb7fabdf8493889625065576e5a3f08c762c7b8897a12e01a9279ec14d719ed9fe0fdc2
7
- data.tar.gz: b4ab2f041f1c767a40f9c68e472f0c2cc78bbdf64cc66db9892857ae0078c72caef397cc9df4f35f349556e4dfb7fe50e8b7bcc2d97dde3e67d35128a5d52003
6
+ metadata.gz: acfff6e407a97710caacf3f72dc6aab6f8919440b9f575795508b408e3c2eceaf207e158a7d19924275ad6f3433cd825653b931ac120e5e4ed49e18fd1a2463d
7
+ data.tar.gz: 6eb95a261a1d149bfdd711af350eac0d52da6b72250ffcaf426dd7f7fcf5663542abd9bab9abd6aebdc6437af2866d0a34795f74bd6b4eacc88c8733a21a1045
data/Gemfile.lock CHANGED
@@ -1,28 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- baudelaire (0.1.0)
4
+ baudelaire (0.1.1)
5
5
  activerecord
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.21)
11
- activesupport (= 3.2.21)
12
- builder (~> 3.0.0)
13
- activerecord (3.2.21)
14
- activemodel (= 3.2.21)
15
- activesupport (= 3.2.21)
16
- arel (~> 3.0.2)
17
- tzinfo (~> 0.3.29)
18
- activesupport (3.2.21)
19
- i18n (~> 0.6, >= 0.6.4)
20
- multi_json (~> 1.0)
21
- arel (3.0.3)
22
- builder (3.0.4)
10
+ activemodel (4.2.4)
11
+ activesupport (= 4.2.4)
12
+ builder (~> 3.1)
13
+ activerecord (4.2.4)
14
+ activemodel (= 4.2.4)
15
+ activesupport (= 4.2.4)
16
+ arel (~> 6.0)
17
+ activesupport (4.2.4)
18
+ i18n (~> 0.7)
19
+ json (~> 1.7, >= 1.7.7)
20
+ minitest (~> 5.1)
21
+ thread_safe (~> 0.3, >= 0.3.4)
22
+ tzinfo (~> 1.1)
23
+ arel (6.0.3)
24
+ builder (3.2.2)
23
25
  diff-lcs (1.2.5)
24
- i18n (0.6.11)
25
- multi_json (1.10.1)
26
+ i18n (0.7.0)
27
+ json (1.8.3)
28
+ minitest (5.8.4)
26
29
  rake (10.3.2)
27
30
  rspec (2.14.1)
28
31
  rspec-core (~> 2.14.0)
@@ -32,8 +35,10 @@ GEM
32
35
  rspec-expectations (2.14.5)
33
36
  diff-lcs (>= 1.1.3, < 2.0)
34
37
  rspec-mocks (2.14.6)
35
- sqlite3 (1.3.6)
36
- tzinfo (0.3.42)
38
+ sqlite3 (1.3.11)
39
+ thread_safe (0.3.5)
40
+ tzinfo (1.2.2)
41
+ thread_safe (~> 0.1)
37
42
 
38
43
  PLATFORMS
39
44
  ruby
@@ -43,3 +48,6 @@ DEPENDENCIES
43
48
  rake
44
49
  rspec
45
50
  sqlite3
51
+
52
+ BUNDLED WITH
53
+ 1.10.6
data/README.md CHANGED
@@ -37,6 +37,18 @@ Then you will be able to do something like:
37
37
  tv_show.kind = 'drama'
38
38
  tv_show.kind # will return :drama
39
39
 
40
+ Then you will be able to do something like:
41
+
42
+ tv_show = TvShow.new
43
+ tv_show.kind = 'drama'
44
+ tv_show.kind # will return :drama
45
+
46
+ Also, from version 0.1.1, empty strings are exposed as nils:
47
+
48
+ tv_show = TvShow.new
49
+ tv_show.kind = ''
50
+ tv_show.kind # will return nil
51
+
40
52
  TODO
41
53
  ----
42
54
 
@@ -45,4 +57,5 @@ Do you have something in mind? Issue a PR! Bonus points for testing :)
45
57
  Changelog
46
58
  ---------
47
59
 
60
+ * v.0.1.1 Now, empty strings are exposed as nils
48
61
  * v.0.1.0 Basic feature: getters and setters for symbolized attributes
@@ -14,11 +14,23 @@ module Baudelaire
14
14
 
15
15
  define_method(:"#{field}") do
16
16
  value = self[field]
17
- value = value.to_sym if value
18
- value
17
+
18
+ if is_symbolizable?(value)
19
+ value = value.to_sym
20
+ else
21
+ nil
22
+ end
19
23
  end
20
24
  end
21
25
  end
22
26
  end
27
+
28
+ private
29
+
30
+ def is_symbolizable?(value)
31
+ return false if value == :""
32
+
33
+ !value.nil?
34
+ end
23
35
  end
24
36
  end
@@ -1,3 +1,3 @@
1
1
  module Baudelaire
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -44,6 +44,14 @@ describe :symbolize do
44
44
  it "should return the symbolized string" do
45
45
  @tv_show.kind.should == :drama
46
46
  end
47
+
48
+ context "which is empty" do
49
+ before { @tv_show.kind = '' }
50
+
51
+ it "should return nil" do
52
+ @tv_show.kind.should be_nil
53
+ end
54
+ end
47
55
  end
48
56
 
49
57
  context "when being a symbol" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baudelaire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Bellonch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project: baudelaire
112
- rubygems_version: 2.2.2
112
+ rubygems_version: 2.4.5.1
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: A string symbolizer