dimensional-enum 0.1.1 → 0.1.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: 571ec740bc3d6ac07b566524e3ba1c681bc5fbf0
4
- data.tar.gz: 4b88f39b7a21427a3d71bf8f79fa01c067a9ff7e
3
+ metadata.gz: 0ac66a3936bee1e52633b578ceb12f0495b42b83
4
+ data.tar.gz: 5caf8bd27ed3cd1ddad59d465f41c6a15499f74f
5
5
  SHA512:
6
- metadata.gz: ff04c832d47f122221fa4223f42243cfd11a4ad5768d1bbfe2d072e72763247f33f55412800dbd4f0262e3072afc15742c49a4f867887ea086b01514ffef538e
7
- data.tar.gz: c4f1aedd2cf5e6cf79f5de2eacab237e86c520f6391396e2658c20f22475b0e4b5d42e304243aec7cfcb1787c088f467a8dca6c367f14a43e355a11f7d812132
6
+ metadata.gz: d338e8df12222577fe07ca8f209bdd0e3798213d5d9ec2a3d12af35d2df34932d77514dda119f24e31df5f503e80bd9f669e6fdc7bbeaf407a5020f4e4ab35bb
7
+ data.tar.gz: 31b9b10075b9864a32db24bed39174d03e0336cb76d2fcfc0d084130803524d86d509b9171988badc5d381382e91818b4ee27357dd9805720560c23e1485aaf5
@@ -53,6 +53,13 @@ module Dimensional
53
53
 
54
54
  alias_method :value, :id
55
55
 
56
+ def method_missing( method, *args, &block )
57
+ if @enum_attribute[label].has_key? method
58
+ return @enum_attribute[label][method]
59
+ end
60
+ super
61
+ end
62
+
56
63
  end
57
64
  end
58
65
  end
@@ -1,5 +1,5 @@
1
1
  module Dimensional
2
2
  module Enum
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -15,12 +15,26 @@ module Dimensional::Enum
15
15
  expect( enum_attribute.id ).to eq 4
16
16
  end
17
17
 
18
+ it "#value" do
19
+ enum_attributes = Attributes.new Sample::ENUM_ATTRIBUTES[:core]
20
+ enum_attribute = Attribute.new "sale_on_nego", enum_attributes.to_attribute_h(:sale_state)
21
+ expect( enum_attribute.value ).to eq 4
22
+ end
23
+
18
24
  it "#name" do
19
25
  enum_attributes = Attributes.new Sample::ENUM_ATTRIBUTES[:core]
20
26
  enum_attribute = Attribute.new "sale_on_nego", enum_attributes.to_attribute_h(:sale_state)
21
27
  expect( enum_attribute.name ).to eq "商談中"
22
28
  end
23
29
 
30
+ it "#number" do
31
+ enum_attributes = Attributes.new Sample::ENUM_ATTRIBUTES[:core]
32
+ enum_attribute = Attribute.new "sale_on_nego", enum_attributes.to_attribute_h(:sale_state)
33
+ expect( enum_attribute.number ).to eq 400
34
+ enum_attribute = Attribute.new "sale_nego_completed", enum_attributes.to_attribute_h(:sale_state)
35
+ expect( enum_attribute.number ).to eq nil
36
+ end
37
+
24
38
  it "#label" do
25
39
  enum_attributes = Attributes.new Sample::ENUM_ATTRIBUTES[:core]
26
40
  enum_attribute = Attribute.new "sale_on_nego", enum_attributes.to_attribute_h(:sale_state)
@@ -5,11 +5,11 @@ module Sample
5
5
  # ---------------------------
6
6
  core: {
7
7
  sale_state: {
8
- sale_planned: { id: 1, name: '売り出し見込み' },
9
- sale_running: { id: 2, name: '売り出し中' },
10
- sale_stopped: { id: 3, name: '売り止め' },
11
- sale_on_nego: { id: 4, name: '商談中' },
12
- sale_nego_completed: { id: 5, name: '成約済み' }
8
+ sale_planned: { id: 1, name: '売り出し見込み', number: 100 },
9
+ sale_running: { id: 2, name: '売り出し中', number: 200 },
10
+ sale_stopped: { id: 3, name: '売り止め', number: 300 },
11
+ sale_on_nego: { id: 4, name: '商談中', number: 400 },
12
+ sale_nego_completed: { id: 5, name: '成約済み', number: nil }
13
13
  },
14
14
  public_scope: {
15
15
  public_to_all: { id: 1, name: '公開' },
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.1
4
+ version: 0.1.2
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-24 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.2.3
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Extends to handle Rails Enum with multi dimensional attributes.