closed_struct 0.1.0 → 0.1.1

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: 16a5ec50f494a359f18bd1ad634e80f0ed384578
4
- data.tar.gz: 7844e3d7c3503fe89d2dbf75604587743257331a
3
+ metadata.gz: c669df732e5d918f8005a54828a942df5c4b23cd
4
+ data.tar.gz: 30f9baf34069f32b26d7c37ad985d15907f35602
5
5
  SHA512:
6
- metadata.gz: da960e0e9ee69928180d9f3e4b8b5991644b9568c63ebd7aedea2db7c64cd1327c3e8002bea85edf0bdde8c1a905d7f245472c64a66420898f08e676abf015b3
7
- data.tar.gz: 84c8d89840a38ba3c8924c88405d5781f53d6dbb6471e4dfe5fb72967afc868e0366897d41044f4e948b9d948eabecdf525eed79003a318178a50515dcf9120d
6
+ metadata.gz: 5777a4b42559d29b0e502897f236e67b513788aa54a2930db64037d24ef3421b4e43ebf562b59912c709cea097f398fae245b703de45fb7f5cd01795e842c67b
7
+ data.tar.gz: 7ba12f806c71741340cf3a50cd4bcb3df50b1e40b8c3068eb1bc73099943d80dd8f51dbd3944ab428c89e913fede8f7ff31e5e3987c7672ec53b066f1e6f7300
@@ -1,10 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.1
3
4
  - 2.1.0
4
5
  - 2.0.0
5
6
  - 1.9.3
6
7
  - jruby-19mode
7
8
  - jruby-18mode
8
- - rbx
9
9
  - 1.8.7
10
- script: "bundle exec rspec"
10
+ install:
11
+ - gem install bundler -v 1.14.4
12
+ - bundle install --jobs=3 --retry=3
13
+ script: bundle exec rspec
@@ -0,0 +1,2 @@
1
+ 0.1.1
2
+ + Added #empty? to check if there is any data
data/README.md CHANGED
@@ -25,11 +25,23 @@ Or install it yourself as:
25
25
  ClosedStruct.new(:a => :b).a # => :b
26
26
  ClosedStruct.new("a" => :b).a # => :b
27
27
  ClosedStruct.new(:a => :b).c # => raises NoMethodError
28
+
29
+ # It won't allow you to have name clashes in the input:
30
+
31
+ ClosedStruct.new(:a => :b, "a" => :b) # => raises ArgumentError
32
+
33
+ # You can also attach additional methods to your objects like so:
34
+ ClosedStruct.new(:a => :b) do
35
+ def some_method(whatever)
36
+ :something
37
+ end
38
+ end
39
+
28
40
  ```
29
41
 
30
42
  ## Contributing
31
43
 
32
- 1. Fork it ( https://github.com/[my-github-username]/closed_struct/fork )
44
+ 1. Fork it ( https://github.com/obrok/closed_struct/fork )
33
45
  2. Create your feature branch (`git checkout -b my-new-feature`)
34
46
  3. Commit your changes (`git commit -am 'Add some feature'`)
35
47
  4. Push to the branch (`git push origin my-new-feature`)
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.5"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec"
21
+ spec.add_development_dependency "bundler", "~> 1.14"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
24
  end
@@ -25,4 +25,8 @@ class ClosedStruct
25
25
  (other.class == self.class) && (other.to_h == self.to_h)
26
26
  end
27
27
  alias_method :eql?, :==
28
+
29
+ def empty?
30
+ @contents.empty?
31
+ end
28
32
  end
@@ -1,3 +1,3 @@
1
1
  class ClosedStruct
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -15,8 +15,8 @@ describe ClosedStruct do
15
15
  first = ClosedStruct.new(:a => :b)
16
16
  second = ClosedStruct.new(:a => :b)
17
17
 
18
- expect(first == second).to be_true
19
- expect(first.eql?(second)).to be_true
18
+ expect(first == second).to be_truthy
19
+ expect(first.eql?(second)).to be_truthy
20
20
  expect(first.hash).to eq(second.hash)
21
21
  end
22
22
 
@@ -24,8 +24,8 @@ describe ClosedStruct do
24
24
  first = ClosedStruct.new(:a => :b)
25
25
  second = ClosedStruct.new(:a => :c)
26
26
 
27
- expect(first == second).to be_false
28
- expect(first.eql?(second)).to be_false
27
+ expect(first == second).to be_falsey
28
+ expect(first.eql?(second)).to be_falsey
29
29
  expect(first.hash).not_to eq(second.hash)
30
30
  end
31
31
 
@@ -51,4 +51,13 @@ describe ClosedStruct do
51
51
  expect { ClosedStruct.new(:a => :b, "a" => :b) }.
52
52
  to raise_error(ArgumentError)
53
53
  end
54
+
55
+ it "is empty when no contents" do
56
+ expect(ClosedStruct.new({}).empty?).to be_truthy
57
+ end
58
+
59
+ it "is not empty when have any contents" do
60
+ expect(ClosedStruct.new(:a => :b).empty?).to be_falsey
61
+ end
62
+
54
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: closed_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Obrok
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2017-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '1.14'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '1.14'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.0'
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: '0'
54
+ version: '3.0'
55
55
  description: ClosedStructs work like OpenStruct, with the exception of being immutable
56
56
  and not responding to methods which haven't been listed in the input hash
57
57
  email:
@@ -62,6 +62,7 @@ extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
64
  - ".travis.yml"
65
+ - CHANGELOG
65
66
  - Gemfile
66
67
  - LICENSE.txt
67
68
  - README.md
@@ -90,10 +91,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  version: '0'
91
92
  requirements: []
92
93
  rubyforge_project:
93
- rubygems_version: 2.2.2
94
+ rubygems_version: 2.2.0
94
95
  signing_key:
95
96
  specification_version: 4
96
97
  summary: An immutable, strict version of OpenStruct
97
98
  test_files:
98
99
  - spec/closed_struct_spec.rb
99
- has_rdoc: