view_component_storybook 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc377c2ee4e53057d77622560164f181fcaca50a95e4fcfc53ad78a3cb10a2ba
|
4
|
+
data.tar.gz: b1137074ecbb7b5d44c38475774d06400b936f427dfec1bd1602fe4edb1696d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8bbafc19737e00f631c0099affc6c616e327c4bfc60e9426fb74e55550701d915131f15d5d00d780dd3b6374c940edd17feebe24774c91e48db84accd46930d
|
7
|
+
data.tar.gz: 2d992393f87285d057bedaffd9be722cd8d147a38f543b2a1afdb9c92d73e6ce26546744941826cd91517c2d1f30e27f782d8090e07d420343241c1a5bb20c8d
|
@@ -21,7 +21,7 @@ module ViewComponent
|
|
21
21
|
|
22
22
|
TYPES = %i[select multi-select radio inline-radio check inline-check].freeze
|
23
23
|
|
24
|
-
attr_reader :type, :options
|
24
|
+
attr_reader :type, :options, :symbol_value
|
25
25
|
|
26
26
|
validates :value, :type, :options, presence: true
|
27
27
|
validates :type, inclusion: { in: TYPES }, unless: -> { type.nil? }
|
@@ -31,6 +31,15 @@ module ViewComponent
|
|
31
31
|
super(component, param, default_value, name: name)
|
32
32
|
@type = type
|
33
33
|
@options = options
|
34
|
+
@symbol_value = default_value.is_a?(Symbol)
|
35
|
+
end
|
36
|
+
|
37
|
+
def value_from_param(param)
|
38
|
+
if param.is_a?(String) && symbol_value
|
39
|
+
param.to_sym
|
40
|
+
else
|
41
|
+
super(param)
|
42
|
+
end
|
34
43
|
end
|
35
44
|
|
36
45
|
private
|