thirtythirty 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -1
- data/Gemfile.lock +31 -0
- data/lib/thirtythirty.rb +4 -1
- data/spec/thirtythirty_spec.rb +32 -0
- data/thirtythirty.gemspec +2 -1
- metadata +21 -4
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
thirtythirty (0.0.7)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
builder (3.0.0)
|
10
|
+
ci_reporter (1.6.4)
|
11
|
+
builder (>= 2.1.2)
|
12
|
+
diff-lcs (1.1.2)
|
13
|
+
rake (0.8.7)
|
14
|
+
rspec (2.4.0)
|
15
|
+
rspec-core (~> 2.4.0)
|
16
|
+
rspec-expectations (~> 2.4.0)
|
17
|
+
rspec-mocks (~> 2.4.0)
|
18
|
+
rspec-core (2.4.0)
|
19
|
+
rspec-expectations (2.4.0)
|
20
|
+
diff-lcs (~> 1.1.2)
|
21
|
+
rspec-mocks (2.4.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
java
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
ci_reporter (~> 1.6.3)
|
29
|
+
rake (= 0.8.7)
|
30
|
+
rspec (~> 2.4.0)
|
31
|
+
thirtythirty!
|
data/lib/thirtythirty.rb
CHANGED
@@ -7,7 +7,10 @@ module Thirtythirty
|
|
7
7
|
send :include, InstanceMethods
|
8
8
|
@marshalled_attributes = []
|
9
9
|
end
|
10
|
-
|
10
|
+
attributes_to_add = attributes.flatten.map(&:to_sym).uniq
|
11
|
+
added_attributes = attributes_to_add - @marshalled_attributes
|
12
|
+
@marshalled_attributes = (@marshalled_attributes | attributes_to_add)
|
13
|
+
added_attributes
|
11
14
|
end
|
12
15
|
|
13
16
|
# Activates marshalling for the given attributes and generates getters - you have to implement setters yourself!
|
data/spec/thirtythirty_spec.rb
CHANGED
@@ -96,6 +96,38 @@ describe Thirtythirty do
|
|
96
96
|
|
97
97
|
end
|
98
98
|
|
99
|
+
describe "combined marshalling" do
|
100
|
+
|
101
|
+
subject do
|
102
|
+
Class.new(ThirtythirtyBase) do
|
103
|
+
attr_reader :untouched
|
104
|
+
def untouched=(untouched)
|
105
|
+
@untouched = untouched.upcase
|
106
|
+
end
|
107
|
+
marshal :untouched
|
108
|
+
marshalled_accessor :touched
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should add given attributes to marshalled attributes (symbolized, unique, frozen)" do
|
113
|
+
subject.marshalled_attributes.should =~ [:touched, :untouched]
|
114
|
+
subject.marshalled_attributes.should be_frozen
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should generate a reader and a writer for attribute touched" do
|
118
|
+
obj = subject.new
|
119
|
+
obj.should respond_to(:touched)
|
120
|
+
obj.should respond_to(:touched)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should not regenerate reader and writer for attribute untouched" do
|
124
|
+
obj = subject.new
|
125
|
+
obj.untouched = "down"
|
126
|
+
obj.untouched.should == "DOWN"
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
99
131
|
describe "#marshalled_attributes" do
|
100
132
|
|
101
133
|
it "should give all marshalled attributes" do
|
data/thirtythirty.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "thirtythirty"
|
4
|
-
s.version = "0.0.
|
4
|
+
s.version = "0.0.8"
|
5
5
|
s.date = Time.now
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.authors = ["Benjamin Behr", "Thomas Jachmann"]
|
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_development_dependency "ci_reporter", "~> 1.6.3"
|
16
16
|
s.add_development_dependency "rspec", "~> 2.4.0"
|
17
|
+
s.add_development_dependency "rake", "0.8.7"
|
17
18
|
|
18
19
|
s.files = `git ls-files`.split("\n")
|
19
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thirtythirty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Behr
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-28 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -51,6 +51,22 @@ dependencies:
|
|
51
51
|
version: 2.4.0
|
52
52
|
type: :development
|
53
53
|
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rake
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - "="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 49
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
- 8
|
66
|
+
- 7
|
67
|
+
version: 0.8.7
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id003
|
54
70
|
description: This gem allows for customization of which data to marshal, especially useful for selective session data serialization.
|
55
71
|
email:
|
56
72
|
- benny@digitalbehr.de
|
@@ -65,6 +81,7 @@ files:
|
|
65
81
|
- .gitignore
|
66
82
|
- .rspec
|
67
83
|
- Gemfile
|
84
|
+
- Gemfile.lock
|
68
85
|
- README.rdoc
|
69
86
|
- Rakefile
|
70
87
|
- lib/thirtythirty.rb
|