attr_init 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -1
- data/attr_init.gemspec +2 -2
- data/lib/attr_init/version.rb +1 -1
- data/spec/attr_init_spec.rb +6 -0
- data/spec/spec_helper.rb +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc859365c8ea9d1d78cf83feaed062c4f843822c
|
4
|
+
data.tar.gz: e432f2b7cbf1199b03169e82ce9a04bd6726f765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d406ab5e4409f4419090a8525e5bbff4c0be0797c5e74dc31a7f1b64624e2394033c1df0a7de2883eac495426755c5d6aef982c6ad5d4d2e681ef8b8b4befb8a
|
7
|
+
data.tar.gz: fc6414ba838611d57a8d9df5c8e8b85b596e2b2e16f52e1f4893bab96bd4cba94ee1625c3cacceb61e914e4c5ad8761f4c1247a7004332ed8bd542d2dd864d12
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# AttrInit
|
2
|
-
|
2
|
+
[![Gem
|
3
|
+
Version](https://badge.fury.io/rb/attr_init.svg)](http://badge.fury.io/rb/attr_init)
|
4
|
+
[![Build
|
5
|
+
Status](https://travis-ci.org/johnmcconnell/attr_init.svg?branch=master)](https://travis-ci.org/johnmcconnell/attr_init)
|
3
6
|
[![Coverage
|
4
7
|
Status](https://coveralls.io/repos/johnmcconnell/attr_init/badge.png)](https://coveralls.io/r/johnmcconnell/attr_init)
|
5
8
|
|
@@ -91,6 +94,19 @@ d.a = 2
|
|
91
94
|
=> 2
|
92
95
|
```
|
93
96
|
|
97
|
+
### Struct adds #to_h
|
98
|
+
```ruby
|
99
|
+
class Dah
|
100
|
+
accessor_struct :a, :b
|
101
|
+
end
|
102
|
+
|
103
|
+
d = Dah.new(a: 0, b: 1)
|
104
|
+
=> #<Dah:0x81ad601c @a=0, @b=1>
|
105
|
+
|
106
|
+
d.to_h
|
107
|
+
=> {:a => 0, :b => 1}
|
108
|
+
```
|
109
|
+
|
94
110
|
## Contributing
|
95
111
|
|
96
112
|
1. Fork it ( https://github.com/[johnmcconnell]/attr_init/fork )
|
data/attr_init.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["johnnyillinois@gmail.com"]
|
11
11
|
spec.summary = %q{Reader structs for ruby finally!.}
|
12
12
|
spec.description = %q{Reader structs for ruby finally!.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/johnmcconnell/attr_init"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "simplecov", "~> 0.8.0"
|
22
22
|
spec.add_development_dependency "coveralls", "~> 0.7.0"
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
26
|
end
|
data/lib/attr_init/version.rb
CHANGED
data/spec/attr_init_spec.rb
CHANGED
@@ -25,6 +25,12 @@ describe AttrInit do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '::new' do
|
28
|
+
it 'defines #to_h' do
|
29
|
+
object = reader_struct.new(hash_params)
|
30
|
+
|
31
|
+
expect(object.to_h).to eq hash_params
|
32
|
+
end
|
33
|
+
|
28
34
|
context 'reader_struct' do
|
29
35
|
it 'initializes readers with hash initializer' do
|
30
36
|
object = reader_struct.new(hash_params)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_init
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- johnmcconnell
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ files:
|
|
98
98
|
- lib/attr_init/version.rb
|
99
99
|
- spec/attr_init_spec.rb
|
100
100
|
- spec/spec_helper.rb
|
101
|
-
homepage:
|
101
|
+
homepage: https://github.com/johnmcconnell/attr_init
|
102
102
|
licenses:
|
103
103
|
- MIT
|
104
104
|
metadata: {}
|