mystique 0.6.0 → 0.7.0
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/lib/mystique/presenter.rb +8 -6
- data/lib/mystique/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e2821f43b65346ff984fd7ea046244d322529b7f6c03f3493f40db4120d7bf9
|
|
4
|
+
data.tar.gz: ac9ad25b4a6f0b5058a4bbc7058967a059774498947793bb438b3af524b26f34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fedd40c256cc88bd394f601efd63fdf54d319a2e6eb9f95fb0df1698aa38945483a33802a81e2db10be8ce9bfc26b331a460d87a71b57509316c1d502ecde6b9
|
|
7
|
+
data.tar.gz: 5cfe5ec34b74395e944f7ce26dfe0f24a7bf258ee6972598af5e96796afa9969da9bffb48339aa12083df3c05fa98f85218bfd31744419cfab7ff8cb6f0681f7
|
data/lib/mystique/presenter.rb
CHANGED
|
@@ -35,18 +35,20 @@ module Mystique
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def format(value)
|
|
38
|
-
result =
|
|
38
|
+
result = case
|
|
39
|
+
when __formats__.keys.include?(value)
|
|
39
40
|
__formats__[value]
|
|
40
|
-
|
|
41
|
+
when __regex_formats__.any? { |regex, _| value =~ regex}
|
|
41
42
|
__regex_formats__.select { |regex, _| value =~ regex}.first.last
|
|
42
|
-
|
|
43
|
+
when __class_formats__.any? { |klass, _| value.is_a?(klass)}
|
|
43
44
|
__class_formats__.select { |klass, _| value.is_a?(klass)}.first.last
|
|
44
45
|
else
|
|
45
46
|
value
|
|
46
47
|
end
|
|
47
|
-
|
|
48
|
+
|
|
49
|
+
Mystique.present(Callable(result).call(value, context))
|
|
48
50
|
end
|
|
49
|
-
|
|
51
|
+
|
|
50
52
|
def self.context(ctx=Undefined)
|
|
51
53
|
@__context__ = ctx unless ctx == Undefined
|
|
52
54
|
@__context__
|
|
@@ -67,7 +69,7 @@ module Mystique
|
|
|
67
69
|
end
|
|
68
70
|
|
|
69
71
|
def self.__formats__
|
|
70
|
-
|
|
72
|
+
@@__formats__ ||= {}
|
|
71
73
|
end
|
|
72
74
|
|
|
73
75
|
def __regex_formats__
|
data/lib/mystique/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mystique
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Federico Iachetti
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-11-
|
|
11
|
+
date: 2018-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|