mystique 0.6.0 → 0.7.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: d9603014937dc82f4e81b4e1fce4997aeae3b57c7eb332a00ee6461bf79ecc32
4
- data.tar.gz: 34ec93591341d4df02f820fe634f7fcdbc415a762fdcaf5c97f8ad90798bf049
3
+ metadata.gz: 6e2821f43b65346ff984fd7ea046244d322529b7f6c03f3493f40db4120d7bf9
4
+ data.tar.gz: ac9ad25b4a6f0b5058a4bbc7058967a059774498947793bb438b3af524b26f34
5
5
  SHA512:
6
- metadata.gz: 3588e13a44caf7e17ae68d6c433b1e18d1e4300b167c050b88b0b1ad5aa195ce34115e57f06454e5a546949b76c02d1e2c4acc528d5ce7269518b75011741019
7
- data.tar.gz: ed0709c2b2991110952fca79a892fba077f5acc3c14b2a3ea758902de45e48ea58dddb7a3ba31b50d6ea2ef470d3c5767087cd851f97851b477c6ed7fbdb7e8d
6
+ metadata.gz: fedd40c256cc88bd394f601efd63fdf54d319a2e6eb9f95fb0df1698aa38945483a33802a81e2db10be8ce9bfc26b331a460d87a71b57509316c1d502ecde6b9
7
+ data.tar.gz: 5cfe5ec34b74395e944f7ce26dfe0f24a7bf258ee6972598af5e96796afa9969da9bffb48339aa12083df3c05fa98f85218bfd31744419cfab7ff8cb6f0681f7
@@ -35,18 +35,20 @@ module Mystique
35
35
  end
36
36
 
37
37
  def format(value)
38
- result = if __formats__.keys.include?(value)
38
+ result = case
39
+ when __formats__.keys.include?(value)
39
40
  __formats__[value]
40
- elsif __regex_formats__.any? { |regex, _| value =~ regex}
41
+ when __regex_formats__.any? { |regex, _| value =~ regex}
41
42
  __regex_formats__.select { |regex, _| value =~ regex}.first.last
42
- elsif __class_formats__.any? { |klass, _| value.is_a?(klass)}
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
- Mystique.present(Callable(result).call(value, context))
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
- @__formats__ ||= { nil => "-----" }
72
+ @@__formats__ ||= {}
71
73
  end
72
74
 
73
75
  def __regex_formats__
@@ -1,3 +1,3 @@
1
1
  module Mystique
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
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.6.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-02 00:00:00.000000000 Z
11
+ date: 2018-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler