enum-x 1.0.0 → 1.0.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 +4 -4
- data/.travis.yml +6 -0
- data/Gemfile.lock +1 -1
- data/lib/enum_x/value.rb +2 -2
- data/lib/enum_x/version.rb +1 -1
- data/spec/enum_x_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: 65ef2227ed4dbfc2f73f239e0457ffe9fb6a4909
|
4
|
+
data.tar.gz: 121052685c06ea6b5889797f4e07888cbad010f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3f9ae905079f8d12314c636b5567bec33126e64a7a40a5970bf7d236327cbe0d90123665ab0f6245adbba2c2f1891e2fb5981b115c8cf705e9b41bfdc03c788
|
7
|
+
data.tar.gz: b39027d23203ca612e7cad2562f8dceca054145bcbf7c055bc2413dc4f0243fc6928c697945c0c684c6625628d89149eba8d3e9b7502357443bf58878cabaa47
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
data/lib/enum_x/value.rb
CHANGED
@@ -88,7 +88,7 @@ class EnumX
|
|
88
88
|
def to_f; value.to_f end
|
89
89
|
|
90
90
|
def respond_to?(method)
|
91
|
-
if method =~ /^to_/ && !%w[ to_int to_a to_ary ].include?(method.to_s)
|
91
|
+
if method =~ /^to_/ && !%w[ to_int to_a to_ary to_hash ].include?(method.to_s)
|
92
92
|
true
|
93
93
|
elsif method =~ /\?$/ && enum.values.include?($`)
|
94
94
|
true
|
@@ -98,7 +98,7 @@ class EnumX
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def method_missing(method, *args, &block)
|
101
|
-
if method =~ /^to_/ && !%w[ to_int to_a to_ary ].include?(method.to_s)
|
101
|
+
if method =~ /^to_/ && !%w[ to_int to_a to_ary to_hash ].include?(method.to_s)
|
102
102
|
@formats[$'] || value
|
103
103
|
elsif method =~ /\?$/
|
104
104
|
value = $`
|
data/lib/enum_x/version.rb
CHANGED
data/spec/enum_x_spec.rb
CHANGED
@@ -224,6 +224,10 @@ describe EnumX do
|
|
224
224
|
specify { expect(simple_value.to_number).to eql('one') }
|
225
225
|
specify { expect(simple_value.to_xml).to eql('one') }
|
226
226
|
specify { expect(simple_value.to_json).to eql('"one"') }
|
227
|
+
|
228
|
+
specify { expect(simple_value).not_to respond_to(:to_hash) }
|
229
|
+
specify { expect{simple_value.to_hash}.to raise_error(NoMethodError) }
|
230
|
+
|
227
231
|
specify { expect(simple_value.hash).to eql('one'.hash) }
|
228
232
|
|
229
233
|
specify { expect(complex_value.value).to eql('three') }
|
@@ -233,6 +237,7 @@ describe EnumX do
|
|
233
237
|
specify { expect(complex_value.to_number).to eql('3') }
|
234
238
|
specify { expect(complex_value.to_xml).to eql('three') }
|
235
239
|
specify { expect(complex_value.to_json).to eql('"three"') }
|
240
|
+
|
236
241
|
specify { expect(complex_value.hash).to eql('three'.hash) }
|
237
242
|
|
238
243
|
describe 'duplication' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enum-x
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joost Lubach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- .gitignore
|
91
91
|
- .ruby-gemset
|
92
92
|
- .ruby-version
|
93
|
+
- .travis.yml
|
93
94
|
- CHANGELOG.md
|
94
95
|
- Gemfile
|
95
96
|
- Gemfile.lock
|