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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ac4da940e9aac44e5b6f93bfd18fa763c8df251
4
- data.tar.gz: 67fda67586d2e8a24917d05a122618c2a10b7610
3
+ metadata.gz: 8924be7abf7342b4cd8d9fe5d760db61dddba130
4
+ data.tar.gz: 3548c34e1e9523c0c5f2dde640d8b481e6ecab22
5
5
  SHA512:
6
- metadata.gz: 6d53b48665b24a79853ffbfd34660a15059ff3f45f20dc7f1e932a123967198bf30ee173b6bd776ac0a90713892371eb5c1728f4c39a57b098982a3cbc134809
7
- data.tar.gz: 2f4532ee0b213475c9f4547c6d5539d9e40e2eed317b633aa9564f0068628eb8a77a2acd3ead67c2acbe4397a7266d1d9a50a15705b6c06693e527e48f5bef53
6
+ metadata.gz: 7a0bf829dee99bc11449102a0c8f981052d057e89e54888042d8b7e916d022f797e7490cb7b9d402a6c375adc392300f2488f583439f09d1b620285d33b39f41
7
+ data.tar.gz: 3fa4495a677025a13fe1c92917b15fa233b4d574af7c833614bf4d3f45d219fdbde3c4e5fa17e3406992214325fe84880cb063f3feb73be8311353e9d168d248
@@ -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
- value = target.send(method, *args, &block)
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"
@@ -0,0 +1,7 @@
1
+ class HashPresenter < Mystique::Presenter
2
+ def each
3
+ super do |k, v|
4
+ yield(Mystique.present(k), Mystique.present(v))
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Mystique
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
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.5.0
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-12 00:00:00.000000000 Z
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