attr_init 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f8d8370936afc741606695fc33b963636f01dfe
4
- data.tar.gz: 8174381ab0003632aa7feb366a778d2d6be342dd
3
+ metadata.gz: cc859365c8ea9d1d78cf83feaed062c4f843822c
4
+ data.tar.gz: e432f2b7cbf1199b03169e82ce9a04bd6726f765
5
5
  SHA512:
6
- metadata.gz: 6c8ebc6254c78d3d872cce690b20bb5ac571dd4644385a39406aebffa001546cfa8ac03658bf9618d58c1ceab339b452cbe243c5433e01f973e8fd510e8e4c78
7
- data.tar.gz: 51690168d15f9179dc8ee5d6087784d6743521b1b13f5c8af27d9c535e127cb7f44e3713a7b987f0539536fea77f5b4a9e7d89d7cf5f48335b816fc75e9d51ec
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.7"
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
@@ -1,3 +1,3 @@
1
1
  module AttrInit
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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
@@ -1,5 +1,4 @@
1
1
  require 'attr_init'
2
- require 'vcr'
3
2
  require 'coveralls'
4
3
 
5
4
  Coveralls.wear!
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.1
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.7'
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.7'
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: {}