named_struct 0.0.3 → 0.1.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/.travis.yml +8 -0
- data/README.md +3 -1
- data/Rakefile +6 -0
- data/lib/named_struct/config.rb +4 -0
- data/lib/named_struct/version.rb +1 -1
- data/spec/named_struct/config_spec.rb +5 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae1793d1da62fd8718f8ef432325a042b3980490
|
4
|
+
data.tar.gz: 34a30c19895ded3b8d90b71b7c823d16873d886d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f32cf81f1dd1f406adcca6876ceabf23d4929f014780b767c10e27712005dbbe9603fb9cfa54312cf186fa91d6301822fd275ffda2e7bf5ba1d8b9f073371ffd
|
7
|
+
data.tar.gz: ffc006124e55c8c6ee35e2ad13c2700f02554697907da791bcf2778bb0105cb3530f17da799ba2758873689997e65f63440b9907fb7edca35176a64daea0df55
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# NamedStruct
|
1
|
+
# NamedStruct [](https://travis-ci.org/mshytikov/named_struct) [](https://codeclimate.com/github/mshytikov/named_struct)
|
2
2
|
|
3
3
|
Simple object to wrap your configuration, it can be instantiated only
|
4
4
|
with required named arguments.
|
@@ -45,6 +45,8 @@ Or install it yourself as:
|
|
45
45
|
## Usage
|
46
46
|
|
47
47
|
```
|
48
|
+
require 'named_struct'
|
49
|
+
|
48
50
|
class MyConfig < NamedStruct::Config
|
49
51
|
attr_required :a, :b, :c
|
50
52
|
end
|
data/Rakefile
CHANGED
data/lib/named_struct/config.rb
CHANGED
data/lib/named_struct/version.rb
CHANGED
@@ -32,6 +32,11 @@ RSpec.describe NamedStruct::Config do
|
|
32
32
|
it { is_expected.to be_frozen }
|
33
33
|
end
|
34
34
|
|
35
|
+
describe '#to_h' do
|
36
|
+
subject{ MyConfig.new(a: 10, b: 11).to_h }
|
37
|
+
it { is_expected.to eq({ a: 10, b: 11 }) }
|
38
|
+
end
|
39
|
+
|
35
40
|
context "without arguments" do
|
36
41
|
subject{ MyConfig.new}
|
37
42
|
let(:error_message) { "missing keyword: a, b" }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: named_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Shytikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,6 +88,7 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
91
92
|
- Gemfile
|
92
93
|
- LICENSE.txt
|
93
94
|
- README.md
|