representation 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.rdoc → README.md} +24 -5
- data/VERSION +1 -1
- data/representation.gemspec +75 -0
- metadata +5 -4
data/{README.rdoc → README.md}
RENAMED
@@ -1,13 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# representation
|
3
2
|
Create different, named representations of a resource for cleaner state representation.
|
4
3
|
|
5
|
-
|
4
|
+
## Install
|
6
5
|
|
7
6
|
gem 'representation'
|
8
7
|
bundle
|
9
8
|
|
10
|
-
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
class User < ActiveRecord::Base
|
13
|
+
include Representation
|
14
|
+
representation :public, :name, :calculated_age
|
15
|
+
representation :internal, :name, :ssn, :age
|
16
|
+
|
17
|
+
def calculated_age
|
18
|
+
age * 2
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
User.first.representation(:public).inspect
|
23
|
+
=> #<User name: "Tweedle Dum", calculated_age: 84>
|
24
|
+
|
25
|
+
User.first.representation(:internal).inspect
|
26
|
+
=> #<User name: "Tweedle Dum", age: 42, ssn: "555-55-5555">
|
27
|
+
````
|
28
|
+
|
29
|
+
## Contributing to representation
|
11
30
|
|
12
31
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
13
32
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
@@ -17,7 +36,7 @@ Create different, named representations of a resource for cleaner state represen
|
|
17
36
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
18
37
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
19
38
|
|
20
|
-
|
39
|
+
## Copyright
|
21
40
|
|
22
41
|
Copyright (c) 2011 Chris Johnson, SocialVibe. See LICENSE.txt for further details.
|
23
42
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{representation}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Chris Johnson"]
|
12
|
+
s.date = %q{2011-07-14}
|
13
|
+
s.description = %q{Create different, named representations of a resource for cleaner state representation.}
|
14
|
+
s.email = %q{findchris@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/representation.rb",
|
29
|
+
"lib/representation/active_record.rb",
|
30
|
+
"rails/init.rb",
|
31
|
+
"representation.gemspec",
|
32
|
+
"spec/representation_spec.rb",
|
33
|
+
"spec/spec_helper.rb",
|
34
|
+
"spec/support/connection.rb",
|
35
|
+
"spec/support/models.rb",
|
36
|
+
"spec/support/representation.sqlite3",
|
37
|
+
"spec/support/schema.rb"
|
38
|
+
]
|
39
|
+
s.homepage = %q{http://github.com/findchris/representation}
|
40
|
+
s.licenses = ["MIT"]
|
41
|
+
s.require_paths = ["lib"]
|
42
|
+
s.rubygems_version = %q{1.6.2}
|
43
|
+
s.summary = %q{Model logical groups of attributes as different object representations.}
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0"])
|
50
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0"])
|
51
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
54
|
+
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0"])
|
58
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0"])
|
59
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
62
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
63
|
+
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
64
|
+
end
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0"])
|
67
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0"])
|
68
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
69
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
71
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
72
|
+
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: representation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Chris Johnson
|
@@ -98,19 +98,20 @@ extensions: []
|
|
98
98
|
|
99
99
|
extra_rdoc_files:
|
100
100
|
- LICENSE.txt
|
101
|
-
- README.
|
101
|
+
- README.md
|
102
102
|
files:
|
103
103
|
- .document
|
104
104
|
- .rspec
|
105
105
|
- Gemfile
|
106
106
|
- Gemfile.lock
|
107
107
|
- LICENSE.txt
|
108
|
-
- README.
|
108
|
+
- README.md
|
109
109
|
- Rakefile
|
110
110
|
- VERSION
|
111
111
|
- lib/representation.rb
|
112
112
|
- lib/representation/active_record.rb
|
113
113
|
- rails/init.rb
|
114
|
+
- representation.gemspec
|
114
115
|
- spec/representation_spec.rb
|
115
116
|
- spec/spec_helper.rb
|
116
117
|
- spec/support/connection.rb
|
@@ -131,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
132
|
requirements:
|
132
133
|
- - ">="
|
133
134
|
- !ruby/object:Gem::Version
|
134
|
-
hash: -
|
135
|
+
hash: -3085468692160699656
|
135
136
|
segments:
|
136
137
|
- 0
|
137
138
|
version: "0"
|