values 1.7.1 → 1.8.0
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.
- checksums.yaml +4 -4
- data/.gitignore +47 -0
- data/.travis.yml +20 -0
- data/.yardopts +5 -0
- data/Gemfile +16 -11
- data/HISTORY.md +18 -0
- data/LICENSE.txt +2 -1
- data/README.md +60 -6
- data/lib/values.rb +32 -1
- data/spec/values_spec.rb +103 -45
- data/values.gemspec +15 -58
- metadata +15 -53
- data/Gemfile.lock +0 -38
- data/VERSION +0 -1
- data/spec/spec_helper.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade02728d0c6fd45d48ae8181f28d031d44ba4bf
|
4
|
+
data.tar.gz: fcb010bf823e4f78ca45b289b4792869b131d969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4a7e7d13a76c5330fb20e873bea4a6d725bac11d27576a6ad006fae1eee79b90e8c2adbecec0df0bc567dc9f80dc45d5ed296e938edbfe1ea224090efda1ab
|
7
|
+
data.tar.gz: 5e27e473d3deb32aacece7785df5b69e5d0300e7f06648e30374a5c6bb810bde132c702e193a725019688fe01a66367591449f565ee21097bbf5d457e06b3e25
|
data/.gitignore
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
Gemfile.lock
|
14
|
+
|
15
|
+
# rvm
|
16
|
+
.ruby-version
|
17
|
+
.ruby-gemset
|
18
|
+
|
19
|
+
# jeweler generated
|
20
|
+
pkg
|
21
|
+
|
22
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
23
|
+
#
|
24
|
+
# * Create a file at ~/.gitignore
|
25
|
+
# * Include files you want ignored
|
26
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
27
|
+
#
|
28
|
+
# After doing this, these files will be ignored in all your git projects,
|
29
|
+
# saving you from having to 'pollute' every project you touch with them
|
30
|
+
#
|
31
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
32
|
+
#
|
33
|
+
# For MacOS:
|
34
|
+
#
|
35
|
+
#.DS_Store
|
36
|
+
#
|
37
|
+
# For TextMate
|
38
|
+
#*.tmproj
|
39
|
+
#tmtags
|
40
|
+
#
|
41
|
+
# For emacs:
|
42
|
+
#*~
|
43
|
+
#\#*
|
44
|
+
#.\#*
|
45
|
+
#
|
46
|
+
# For vim:
|
47
|
+
#*.swp
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
rvm:
|
4
|
+
- ruby-head
|
5
|
+
- 2.2
|
6
|
+
- 2.1
|
7
|
+
- 2.0.0
|
8
|
+
- 1.9.3
|
9
|
+
- 1.9.2
|
10
|
+
- 1.8.7
|
11
|
+
- ree
|
12
|
+
- jruby-head
|
13
|
+
- jruby-19mode
|
14
|
+
- jruby-18mode
|
15
|
+
- rbx-2
|
16
|
+
matrix:
|
17
|
+
allow_failures:
|
18
|
+
- rvm: ruby-head
|
19
|
+
- rvm: jruby-head
|
20
|
+
fast_finish: true
|
data/.yardopts
ADDED
data/Gemfile
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
-
source
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
1
|
+
source 'https://rubygems.org'
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
gem "jeweler", "~> 1.8.4"
|
12
|
-
gem "simplecov", ">= 0"
|
3
|
+
group :test do
|
4
|
+
gem 'rake', '>= 10.4'
|
5
|
+
if RUBY_VERSION >= '1.9'
|
6
|
+
gem 'codecov', :require => false
|
7
|
+
end
|
13
8
|
end
|
9
|
+
|
10
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '1.9'
|
11
|
+
group :doc do
|
12
|
+
gem 'yard'
|
13
|
+
gem 'redcarpet'
|
14
|
+
gem 'github-markup'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
gemspec
|
data/HISTORY.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Release History Summary
|
2
|
+
|
3
|
+
## [Upcoming Release v1.8.0 (target Jun 30, 2015)](http://github.com/tcrayford/Values/compare/v1.7.1...master)
|
4
|
+
|
5
|
+
- Fix zero-field Value class edge case (#23)
|
6
|
+
- Fix Gemfile.lock issue (#22)
|
7
|
+
- Add a #with method to support hash value replacement (#24)
|
8
|
+
- Add a #to_h method to support conversion to Hash like OpenStruct (#27)
|
9
|
+
- Add Travis CI and badge (#28)
|
10
|
+
- Add CodeCov.io and badge (#29, #36 )
|
11
|
+
- Add gem version badge (#30)
|
12
|
+
- Document with YARD and add a rubydoc.info link to docs (#38)
|
13
|
+
- Document that it also replaces OpenStruct (via #with and #to_h) (#39)
|
14
|
+
- Add HISTORY.md
|
15
|
+
|
16
|
+
## [v1.7.1 (Mar 1, 2015)](https://github.com/tcrayford/Values/commits/v1.7.1)
|
17
|
+
|
18
|
+
- (first release in HISTORY.md)
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,23 @@
|
|
1
|
+
# Values
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/values/)
|
4
|
+
[](https://rubygems.org/gems/values/)
|
5
|
+
[](https://travis-ci.org/tcrayford/Values)
|
6
|
+
[](https://codecov.io/github/tcrayford/Values)
|
7
|
+
[](http://rubydoc.info/github/tcrayford/Values/master/frames)
|
8
|
+
|
9
|
+
## Summary
|
10
|
+
|
1
11
|
Values is a tiny library for creating value objects in ruby.
|
2
|
-
These mostly look like classes created using Struct, but fix two problems with those:
|
3
12
|
|
4
|
-
|
13
|
+
Classes created using [Value](lib/values.rb) mostly look like classes created using
|
14
|
+
[Struct](http://ruby-doc.org/core-2.2.1/Struct.html) or
|
15
|
+
[OpenStruct](http://ruby-doc.org/stdlib-2.2.1/libdoc/ostruct/rdoc/OpenStruct.html),
|
16
|
+
but fix two problems with those:
|
17
|
+
|
18
|
+
## Problems with [Struct](http://ruby-doc.org/core-2.2.1/Struct.html) and [OpenStruct](http://ruby-doc.org/stdlib-2.2.1/libdoc/ostruct/rdoc/OpenStruct.html)
|
19
|
+
|
20
|
+
Struct and OpenStruct constructors can take fewer than the default number of arguments and set other fields as nil:
|
5
21
|
|
6
22
|
```ruby
|
7
23
|
Point = Struct.new(:x, :y)
|
@@ -9,17 +25,34 @@ Point.new(1)
|
|
9
25
|
# => #<struct Point x=1, y=nil>
|
10
26
|
```
|
11
27
|
|
12
|
-
|
28
|
+
```ruby
|
29
|
+
p = OpenStruct.new(x: 1)
|
30
|
+
# => #<OpenStruct x=1>
|
31
|
+
p.y
|
32
|
+
# => nil
|
33
|
+
```
|
34
|
+
|
35
|
+
Struct and OpenStruct objects are mutable:
|
13
36
|
|
14
37
|
```ruby
|
15
|
-
Point = Struct.new(:x, :y)
|
16
38
|
p = Point.new(1, 2)
|
17
39
|
p.x = 2
|
18
40
|
p.x
|
19
41
|
# => 2
|
20
42
|
```
|
21
43
|
|
22
|
-
|
44
|
+
```ruby
|
45
|
+
p = OpenStruct.new(x: 1, y: 2)
|
46
|
+
p.x = 2
|
47
|
+
p.x
|
48
|
+
# => 2
|
49
|
+
```
|
50
|
+
|
51
|
+
## Values is Better
|
52
|
+
|
53
|
+
Values fixes both of the above problems.
|
54
|
+
|
55
|
+
Constructors require expected arguments:
|
23
56
|
|
24
57
|
```ruby
|
25
58
|
Point = Value.new(:x, :y)
|
@@ -29,7 +62,11 @@ Point.new(1)
|
|
29
62
|
# from (irb):5:in new
|
30
63
|
# from (irb):5
|
31
64
|
# from /usr/local/bin/irb:12:in `<main>
|
65
|
+
```
|
66
|
+
|
67
|
+
Instances are immutable:
|
32
68
|
|
69
|
+
```ruby
|
33
70
|
p = Point.new(1, 2)
|
34
71
|
p.x = 1
|
35
72
|
# => NoMethodError: undefined method x= for #<Point:0x00000100943788 @x=0, @y=1>
|
@@ -37,6 +74,8 @@ p.x = 1
|
|
37
74
|
# from /usr/local/bin/irb:12:in <main>
|
38
75
|
```
|
39
76
|
|
77
|
+
## Features
|
78
|
+
|
40
79
|
Values also provides an alternative constructor which takes a hash:
|
41
80
|
|
42
81
|
```ruby
|
@@ -45,6 +84,21 @@ p.x
|
|
45
84
|
# => 3
|
46
85
|
```
|
47
86
|
|
87
|
+
Values can copy and replace fields using a hash:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
p = Point.with(x: 1, y: -1)
|
91
|
+
q = p.with(y: 2)
|
92
|
+
# => #<Point x=1, y=2>
|
93
|
+
```
|
94
|
+
|
95
|
+
Value classes can be converted to a hash, like OpenStruct:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
Point.with(x: 1, y: -1).to_h
|
99
|
+
# => {:x=>1, :y=>-1}
|
100
|
+
```
|
101
|
+
|
48
102
|
Values also supports customization of value classes inheriting from `Value.new`:
|
49
103
|
|
50
104
|
```ruby
|
@@ -59,4 +113,4 @@ p.to_s
|
|
59
113
|
# => "<Point at (1, 2)>"
|
60
114
|
```
|
61
115
|
|
62
|
-
Values does NOT have all the features of Struct (nor is it meant to).
|
116
|
+
Values does NOT have all the features of Struct or OpenStruct (nor is it meant to).
|
data/lib/values.rb
CHANGED
@@ -1,4 +1,22 @@
|
|
1
|
+
# Simple immutable value objects for ruby.
|
2
|
+
#
|
3
|
+
# @example Make a new value class:
|
4
|
+
# Point = Value.new(:x, :y)
|
5
|
+
#
|
6
|
+
# @example And use it:
|
7
|
+
# p = Point.new(1, 0)
|
8
|
+
# p.x
|
9
|
+
# #=> 1
|
10
|
+
# p.y
|
11
|
+
# #=> 0
|
12
|
+
#
|
1
13
|
class Value
|
14
|
+
# Create a new value class.
|
15
|
+
#
|
16
|
+
# @param [Array<Symbol>] fields Names of fields to create in the new value class
|
17
|
+
# @param [Proc] block Optionally, a block to further define the new value class
|
18
|
+
# @return [Class] A new value class with the provided `fields`
|
19
|
+
# @raise [ArgumentError] If no field names are provided
|
2
20
|
def self.new(*fields, &block)
|
3
21
|
raise ArgumentError.new('wrong number of arguments (0 for 1+)') if fields.empty?
|
4
22
|
|
@@ -46,10 +64,23 @@ class Value
|
|
46
64
|
end
|
47
65
|
|
48
66
|
def inspect
|
49
|
-
attributes =
|
67
|
+
attributes = to_a.map { |field, value| "#{field}=#{value.inspect}" }.join(", ")
|
50
68
|
"#<#{self.class.name} #{attributes}>"
|
51
69
|
end
|
52
70
|
|
71
|
+
def with(hash = {})
|
72
|
+
return self if hash.empty?
|
73
|
+
self.class.with(to_h.merge(hash))
|
74
|
+
end
|
75
|
+
|
76
|
+
def to_h
|
77
|
+
Hash[to_a]
|
78
|
+
end
|
79
|
+
|
80
|
+
def to_a
|
81
|
+
self.class::VALUE_ATTRS.map { |field| [field, send(field)] }
|
82
|
+
end
|
83
|
+
|
53
84
|
class_eval &block if block
|
54
85
|
end
|
55
86
|
end
|
data/spec/values_spec.rb
CHANGED
@@ -1,26 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# Enable codecov.io on Ruby 1.9 and later on Travis CI
|
2
|
+
if RUBY_VERSION >= '1.9'
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter '/spec/'
|
5
6
|
end
|
7
|
+
if ENV['CI']=='true'
|
8
|
+
require 'codecov'
|
9
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
10
|
+
end
|
11
|
+
end
|
6
12
|
|
7
|
-
|
13
|
+
# Require rspec and the actual library under test
|
14
|
+
require 'rspec'
|
15
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'values')
|
8
16
|
|
9
|
-
|
10
|
-
|
11
|
-
|
17
|
+
describe Value do
|
18
|
+
|
19
|
+
describe 'Value.new' do
|
20
|
+
it 'raises argument error if given zero fields' do
|
21
|
+
expect { Value.new }.to raise_error(ArgumentError, 'wrong number of arguments (0 for 1+)')
|
22
|
+
end
|
12
23
|
end
|
13
24
|
|
25
|
+
Cell = Value.new(:alive)
|
26
|
+
|
14
27
|
Point = Value.new(:x, :y)
|
15
28
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
29
|
+
describe '.new and the fields of a value class' do
|
30
|
+
it 'stores a single field' do
|
31
|
+
expect(Cell.new(true).alive).to eq(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'stores multiple values' do
|
35
|
+
p = Point.new(0,1)
|
36
|
+
expect(p.x).to eq(0)
|
37
|
+
expect(p.y).to eq(1)
|
38
|
+
end
|
21
39
|
|
22
|
-
|
23
|
-
|
40
|
+
it 'raises argument errors if not given the right number of arguments' do
|
41
|
+
expect { Point.new }.to raise_error(ArgumentError, 'wrong number of arguments, 0 for 2')
|
42
|
+
end
|
24
43
|
end
|
25
44
|
|
26
45
|
class GraphPoint < Value.new(:x, :y)
|
@@ -30,13 +49,11 @@ describe 'values' do
|
|
30
49
|
end
|
31
50
|
|
32
51
|
it 'can be inherited from to add methods' do
|
33
|
-
|
34
|
-
c.inspect.should == 'GraphPoint at 0,0'
|
52
|
+
expect(GraphPoint.new(0,0).inspect).to eq('GraphPoint at 0,0')
|
35
53
|
end
|
36
54
|
|
37
55
|
it 'has a pretty string representation' do
|
38
|
-
|
39
|
-
p.inspect.should == "#<Point x=0, y=1>"
|
56
|
+
expect(Point.new(0, 1).inspect).to eq('#<Point x=0, y=1>')
|
40
57
|
end
|
41
58
|
|
42
59
|
Line = Value.new(:slope, :y_intercept) do
|
@@ -46,8 +63,7 @@ describe 'values' do
|
|
46
63
|
end
|
47
64
|
|
48
65
|
it 'can be customized with a block' do
|
49
|
-
|
50
|
-
l.inspect.should == '<Line: y=2x+3>'
|
66
|
+
expect(Line.new(2, 3).inspect).to eq('<Line: y=2x+3>')
|
51
67
|
end
|
52
68
|
|
53
69
|
it 'cannot be mutated' do
|
@@ -61,9 +77,9 @@ describe 'values' do
|
|
61
77
|
end
|
62
78
|
end
|
63
79
|
|
64
|
-
it 'cannot even be mutated inside a
|
65
|
-
c = Cow.new(
|
66
|
-
expect { c.change_color(
|
80
|
+
it 'cannot even be mutated inside a subclass with methods' do
|
81
|
+
c = Cow.new('red')
|
82
|
+
expect { c.change_color('blue') }.to raise_error
|
67
83
|
end
|
68
84
|
|
69
85
|
Money = Value.new(:amount, :denomination)
|
@@ -75,62 +91,104 @@ describe 'values' do
|
|
75
91
|
|
76
92
|
it 'can be instantiated with a hash' do
|
77
93
|
one_dollar = Money.with(:amount => 1, :denomination => 'USD')
|
78
|
-
one_dollar.amount.
|
79
|
-
one_dollar.denomination.
|
94
|
+
expect(one_dollar.amount).to eq(1)
|
95
|
+
expect(one_dollar.denomination).to eq('USD')
|
80
96
|
end
|
81
97
|
|
82
98
|
it 'errors if you instantiate it from a hash with unrecognised fields' do
|
83
|
-
expect
|
84
|
-
Money.with(:unrecognized_field => 1, :amount => 2, :denomination => 'USD')
|
85
|
-
end.to raise_error
|
99
|
+
expect { Money.with(:unrecognized_field => 1, :amount => 2, :denomination => 'USD') }.to raise_error(ArgumentError)
|
86
100
|
end
|
87
101
|
|
88
102
|
it 'errors if you instantiate it from a hash with missing fields' do
|
89
|
-
expect
|
90
|
-
Money.with({})
|
91
|
-
end.to raise_error(ArgumentError)
|
103
|
+
expect { Money.with({}) }.to raise_error(ArgumentError)
|
92
104
|
end
|
93
105
|
|
94
106
|
it 'does not error when fields are explicitly nil' do
|
95
|
-
expect
|
96
|
-
Money.with(:amount => 1, :denomination => nil)
|
97
|
-
end.not_to raise_error
|
107
|
+
expect { Money.with(:amount => 1, :denomination => nil) }.not_to raise_error
|
98
108
|
end
|
99
109
|
|
100
110
|
describe '#hash and equality' do
|
101
111
|
Y = Value.new(:x, :y)
|
102
112
|
|
103
113
|
it 'is equal to another value with the same fields' do
|
104
|
-
Point.new(0,0).
|
114
|
+
expect(Point.new(0,0)).to eq(Point.new(0,0))
|
105
115
|
end
|
106
116
|
|
107
117
|
it 'is not equal to an object with a different class' do
|
108
|
-
Point.new(0,0).
|
118
|
+
expect(Point.new(0,0)).not_to eq(Y.new(0,0))
|
109
119
|
end
|
110
120
|
|
111
121
|
it 'is not equal to another value with different fields' do
|
112
|
-
Point.new(0,0).
|
113
|
-
Point.new(0,0).
|
122
|
+
expect(Point.new(0,0)).not_to eq(Point.new(0,1))
|
123
|
+
expect(Point.new(0,0)).not_to eq(Point.new(1,0))
|
114
124
|
end
|
115
125
|
|
116
126
|
it 'has an equal hash if the fields are equal' do
|
117
|
-
|
118
|
-
p.hash.should == Point.new(0,0).hash
|
127
|
+
expect(Point.new(0,0).hash).to eq(Point.new(0,0).hash)
|
119
128
|
end
|
120
129
|
|
121
130
|
it 'has a non-equal hash if the fields are different' do
|
122
|
-
|
123
|
-
p.hash.should_not == Point.new(1,0).hash
|
131
|
+
expect(Point.new(0,0).hash).not_to eq(Point.new(1,0).hash)
|
124
132
|
end
|
125
133
|
|
126
134
|
it 'does not have an equal hash if the class is different' do
|
127
|
-
Point.new(0,0).hash.
|
135
|
+
expect(Point.new(0,0).hash).not_to eq(Y.new(0,0).hash)
|
128
136
|
end
|
129
137
|
end
|
130
138
|
|
131
139
|
describe '#values' do
|
132
140
|
it 'returns an array of field values' do
|
133
|
-
Point.new(10, 13).values.
|
141
|
+
expect(Point.new(10, 13).values).to eq([10, 13])
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
ManyAttrs = Value.new(:f, :e, :d, :c, :b, :a)
|
146
|
+
|
147
|
+
describe '#inspect' do
|
148
|
+
let(:v) { ManyAttrs.new(6, 5, 4, 3, 2, 1) }
|
149
|
+
|
150
|
+
it 'returns a string containing attributes in their expected order' do
|
151
|
+
expect(v.inspect).to eq('#<ManyAttrs f=6, e=5, d=4, c=3, b=2, a=1>')
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe '#with' do
|
156
|
+
let(:p) { Point.new(1, -1) }
|
157
|
+
|
158
|
+
describe 'with no arguments' do
|
159
|
+
it 'returns an object equal by value' do
|
160
|
+
expect(p.with).to eq(p)
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'returns an object equal by identity' do
|
164
|
+
expect(p.with).to equal(p)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe 'with hash arguments' do
|
169
|
+
it 'replaces all field values' do
|
170
|
+
expect(p.with({ :x => 1, :y => 2 })).to eq(Point.new(1, 2))
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'defaults to current values if missing' do
|
174
|
+
expect(p.with({ :y => 2 })).to eq(Point.new(1, 2))
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'raises argument error if unknown field' do
|
178
|
+
expect { p.with({ :foo => 3 }) }.to raise_error(ArgumentError)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
describe '#to_h' do
|
184
|
+
it 'returns a hash of fields and values' do
|
185
|
+
expect(Point.new(1, -1).to_h).to eq({ :x => 1, :y => -1 })
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe '#to_a' do
|
190
|
+
it 'returns an array of pairs of fields and values' do
|
191
|
+
expect(Point.new(1, -1).to_a).to eq([[:x, 1], [:y, -1]])
|
134
192
|
end
|
135
193
|
end
|
136
194
|
end
|
data/values.gemspec
CHANGED
@@ -1,61 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.name = "values"
|
3
|
+
gem.version = "1.8.0"
|
4
|
+
gem.platform = Gem::Platform::RUBY
|
5
|
+
gem.authors = ["Tom Crayford", "Marc Siegel"]
|
6
|
+
gem.email = ["tcrayford@googlemail.com", "marc@usainnov.com"]
|
7
|
+
gem.homepage = "http://github.com/tcrayford/values"
|
8
|
+
gem.description = "Simple immutable value objects for ruby.\n\n Make a new value class: Point = Value.new(:x, :y)\n And use it:\n p = Point.new(1,0)\n p.x\n => 1\n p.y\n => 0\n "
|
9
|
+
gem.summary = "Simple immutable value objects for ruby"
|
10
|
+
gem.licenses = ["MIT"]
|
6
11
|
|
7
|
-
|
8
|
-
|
9
|
-
s.version = "1.7.1"
|
12
|
+
gem.required_ruby_version = ">= 1.8.7"
|
13
|
+
gem.add_development_dependency "rspec", "~> 2.11.0"
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
s.date = "2015-03-01"
|
15
|
-
s.description = "Simple immutable value objects for ruby.\n\n Make a new value class: Point = Value.new(:x, :y)\n And use it:\n p = Point.new(1,0)\n p.x\n => 1\n p.y\n => 0\n "
|
16
|
-
s.email = "tcrayford@googlemail.com"
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.md"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".rspec",
|
24
|
-
"Gemfile",
|
25
|
-
"Gemfile.lock",
|
26
|
-
"LICENSE.txt",
|
27
|
-
"README.md",
|
28
|
-
"Rakefile",
|
29
|
-
"VERSION",
|
30
|
-
"lib/values.rb",
|
31
|
-
"spec/spec_helper.rb",
|
32
|
-
"spec/values_spec.rb",
|
33
|
-
"values.gemspec"
|
34
|
-
]
|
35
|
-
s.homepage = "http://github.com/tcrayford/values"
|
36
|
-
s.licenses = ["MIT"]
|
37
|
-
s.rubygems_version = "2.2.2"
|
38
|
-
s.summary = "Simple immutable value objects for ruby"
|
39
|
-
|
40
|
-
if s.respond_to? :specification_version then
|
41
|
-
s.specification_version = 4
|
42
|
-
|
43
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.11.0"])
|
45
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
46
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
47
|
-
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<rspec>, ["~> 2.11.0"])
|
50
|
-
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
51
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
52
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
53
|
-
end
|
54
|
-
else
|
55
|
-
s.add_dependency(%q<rspec>, ["~> 2.11.0"])
|
56
|
-
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
57
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
58
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
59
|
-
end
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
gem.require_paths = ["lib"]
|
60
18
|
end
|
61
|
-
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: values
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Crayford
|
8
|
+
- Marc Siegel
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-
|
12
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rspec
|
@@ -24,68 +25,27 @@ dependencies:
|
|
24
25
|
- - "~>"
|
25
26
|
- !ruby/object:Gem::Version
|
26
27
|
version: 2.11.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: jeweler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.8.4
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.8.4
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: simplecov
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
28
|
description: "Simple immutable value objects for ruby.\n\n Make a new value class:
|
70
29
|
Point = Value.new(:x, :y)\n And use it:\n p = Point.new(1,0)\n p.x\n =>
|
71
30
|
1\n p.y\n => 0\n "
|
72
|
-
email:
|
31
|
+
email:
|
32
|
+
- tcrayford@googlemail.com
|
33
|
+
- marc@usainnov.com
|
73
34
|
executables: []
|
74
35
|
extensions: []
|
75
|
-
extra_rdoc_files:
|
76
|
-
- LICENSE.txt
|
77
|
-
- README.md
|
36
|
+
extra_rdoc_files: []
|
78
37
|
files:
|
79
38
|
- ".document"
|
39
|
+
- ".gitignore"
|
80
40
|
- ".rspec"
|
41
|
+
- ".travis.yml"
|
42
|
+
- ".yardopts"
|
81
43
|
- Gemfile
|
82
|
-
-
|
44
|
+
- HISTORY.md
|
83
45
|
- LICENSE.txt
|
84
46
|
- README.md
|
85
47
|
- Rakefile
|
86
|
-
- VERSION
|
87
48
|
- lib/values.rb
|
88
|
-
- spec/spec_helper.rb
|
89
49
|
- spec/values_spec.rb
|
90
50
|
- values.gemspec
|
91
51
|
homepage: http://github.com/tcrayford/values
|
@@ -100,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
60
|
requirements:
|
101
61
|
- - ">="
|
102
62
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
63
|
+
version: 1.8.7
|
104
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
65
|
requirements:
|
106
66
|
- - ">="
|
@@ -112,4 +72,6 @@ rubygems_version: 2.2.2
|
|
112
72
|
signing_key:
|
113
73
|
specification_version: 4
|
114
74
|
summary: Simple immutable value objects for ruby
|
115
|
-
test_files:
|
75
|
+
test_files:
|
76
|
+
- spec/values_spec.rb
|
77
|
+
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
diff-lcs (1.1.3)
|
5
|
-
docile (1.1.5)
|
6
|
-
git (1.2.5)
|
7
|
-
jeweler (1.8.4)
|
8
|
-
bundler (~> 1.0)
|
9
|
-
git (>= 1.2.5)
|
10
|
-
rake
|
11
|
-
rdoc
|
12
|
-
json (1.7.5)
|
13
|
-
multi_json (1.10.1)
|
14
|
-
rake (0.9.2.2)
|
15
|
-
rdoc (3.12)
|
16
|
-
json (~> 1.4)
|
17
|
-
rspec (2.11.0)
|
18
|
-
rspec-core (~> 2.11.0)
|
19
|
-
rspec-expectations (~> 2.11.0)
|
20
|
-
rspec-mocks (~> 2.11.0)
|
21
|
-
rspec-core (2.11.1)
|
22
|
-
rspec-expectations (2.11.3)
|
23
|
-
diff-lcs (~> 1.1.3)
|
24
|
-
rspec-mocks (2.11.3)
|
25
|
-
simplecov (0.9.2)
|
26
|
-
docile (~> 1.1.0)
|
27
|
-
multi_json (~> 1.0)
|
28
|
-
simplecov-html (~> 0.9.0)
|
29
|
-
simplecov-html (0.9.0)
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
ruby
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
bundler (~> 1.0)
|
36
|
-
jeweler (~> 1.8.4)
|
37
|
-
rspec (~> 2.11.0)
|
38
|
-
simplecov
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.5.0
|
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'values'
|
5
|
-
|
6
|
-
# Requires supporting files with custom matchers and macros, etc,
|
7
|
-
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
|
-
end
|