dimensional-enum 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dimensional/enum/attribute.rb +6 -2
- data/lib/dimensional/enum/version.rb +1 -1
- data/spec/attribute_spec.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 571ec740bc3d6ac07b566524e3ba1c681bc5fbf0
|
4
|
+
data.tar.gz: 4b88f39b7a21427a3d71bf8f79fa01c067a9ff7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff04c832d47f122221fa4223f42243cfd11a4ad5768d1bbfe2d072e72763247f33f55412800dbd4f0262e3072afc15742c49a4f867887ea086b01514ffef538e
|
7
|
+
data.tar.gz: c4f1aedd2cf5e6cf79f5de2eacab237e86c520f6391396e2658c20f22475b0e4b5d42e304243aec7cfcb1787c088f467a8dca6c367f14a43e355a11f7d812132
|
@@ -2,7 +2,7 @@ module Dimensional
|
|
2
2
|
module Enum
|
3
3
|
class Attribute
|
4
4
|
|
5
|
-
delegate *(String.instance_methods - Object.instance_methods), to: :
|
5
|
+
delegate *(String.instance_methods - Object.instance_methods), to: :to_str
|
6
6
|
|
7
7
|
def initialize( enum_attr_key, enum_attribute )
|
8
8
|
@enum_attr_key = enum_attr_key
|
@@ -35,10 +35,14 @@ module Dimensional
|
|
35
35
|
nil
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def to_str
|
39
39
|
label.to_s
|
40
40
|
end
|
41
41
|
|
42
|
+
def to_s
|
43
|
+
to_str
|
44
|
+
end
|
45
|
+
|
42
46
|
def to_sym
|
43
47
|
label.to_sym
|
44
48
|
end
|
data/spec/attribute_spec.rb
CHANGED
@@ -52,7 +52,14 @@ module Dimensional::Enum
|
|
52
52
|
expect( enum_attribute == "sale_on_nego" ).to eq true
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
it "supports right side equality check" do
|
56
|
+
enum_attributes = Attributes.new Sample::ENUM_ATTRIBUTES[:core]
|
57
|
+
enum_attribute = Attribute.new "sale_on_nego", enum_attributes.to_attribute_h(:sale_state)
|
58
|
+
expect( "sale_on_nego" == enum_attribute ).to eq true
|
59
|
+
expect( ["sale_running", "sale_on_nego"].include? enum_attribute ).to eq true
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "Stringを想定したメソッドよびだしがto_strに対しておこなわれること" do
|
56
63
|
let(:enum_attributes) { Attributes.new Sample::ENUM_ATTRIBUTES[:core] }
|
57
64
|
let(:enum_attribute) { enum_attribute = Attribute.new "released", enum_attributes.to_attribute_h(:status) }
|
58
65
|
it "#empty?" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimensional-enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watanabe, Mitsutoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|