mystique 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mystique.rb +6 -3
- data/lib/mystique/presenters.rb +1 -0
- data/lib/mystique/presenters/hash_presenter.rb +7 -0
- data/lib/mystique/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8924be7abf7342b4cd8d9fe5d760db61dddba130
|
4
|
+
data.tar.gz: 3548c34e1e9523c0c5f2dde640d8b481e6ecab22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a0bf829dee99bc11449102a0c8f981052d057e89e54888042d8b7e916d022f797e7490cb7b9d402a6c375adc392300f2488f583439f09d1b620285d33b39f41
|
7
|
+
data.tar.gz: 3fa4495a677025a13fe1c92917b15fa233b4d574af7c833614bf4d3f45d219fdbde3c4e5fa17e3406992214325fe84880cb063f3feb73be8311353e9d168d248
|
data/lib/mystique.rb
CHANGED
@@ -43,7 +43,10 @@ module Mystique
|
|
43
43
|
|
44
44
|
def method_missing(method, *args, &block)
|
45
45
|
return target.send(method, *args, &block) if method.to_s.start_with?("to_")
|
46
|
-
|
46
|
+
format( target.send(method, *args, &block) )
|
47
|
+
end
|
48
|
+
|
49
|
+
def format(value)
|
47
50
|
result = if __formats__.keys.include?(value)
|
48
51
|
__formats__[value]
|
49
52
|
elsif __regex_formats__.any? { |regex, _| value =~ regex}
|
@@ -53,9 +56,9 @@ module Mystique
|
|
53
56
|
else
|
54
57
|
value
|
55
58
|
end
|
56
|
-
Mystique.present(Callable(result).call(value, context))
|
59
|
+
Mystique.present(Callable(result).call(value, context))
|
57
60
|
end
|
58
|
-
|
61
|
+
|
59
62
|
def self.context(ctx=Undefined)
|
60
63
|
@__context__ = ctx unless ctx == Undefined
|
61
64
|
@__context__
|
@@ -0,0 +1 @@
|
|
1
|
+
require "mystique/hash_presenter"
|
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Iachetti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,6 +97,8 @@ files:
|
|
97
97
|
- bin/setup
|
98
98
|
- lib/mystique.rb
|
99
99
|
- lib/mystique/null_context.rb
|
100
|
+
- lib/mystique/presenters.rb
|
101
|
+
- lib/mystique/presenters/hash_presenter.rb
|
100
102
|
- lib/mystique/version.rb
|
101
103
|
- mystique.gemspec
|
102
104
|
homepage: https://github.com/iachettifederico/mystique
|