maglove-engine 2.0.6 → 2.0.7

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: 8b33ea3ae9a4392b21838f7d14ea2fb6782aa6fd
4
- data.tar.gz: fcae4f92106eb3fccf05b56e2895e7dd496769b1
3
+ metadata.gz: a2e5ec24d541ec97e5cd06f7528d96200ba25f26
4
+ data.tar.gz: 941908173805b33a3eec4d2c3bd991789472552b
5
5
  SHA512:
6
- metadata.gz: b99f56682b39e9a8448ac8f8dadfac4fb6a5aa6fbfb7a516316950d2fa6bb8973c81810a0bdfc21d5728ad56dc1745d9e0fd6b54ecb3fa7eccf840982e52bd26
7
- data.tar.gz: 62547cfb134727e8f85204fb1523ef6e5e73741c77ffeb449560655f11bb2a1f3f23bfdcb5f6731ab27d522b7935828ab00fe02e65ca8d77cfcddcc877001b84
6
+ metadata.gz: 85fb6a73cab59398572064539919d3a49b5753650fd5669062200c488964cb27f899c3b486ab2724747f0c6de721874ae82b31753700d1e884fee99b9834fa4f
7
+ data.tar.gz: 07d7f44b8b701e46ecca22f2a9a8c343680ef41f5b3fbd394e21ed74286d63d605c6c0422e6ca964d6497ede867a454b84d7bc66ec119f6c5f7e2ffb634787d7
@@ -4,6 +4,13 @@ module Maglove
4
4
  include Singleton
5
5
  attr_accessor :asset_uri
6
6
  attr_accessor :block_path
7
+ attr_accessor :block_resolver
8
+
9
+ def initialize
10
+ @block_resolver = lambda do |identifier, variables|
11
+ File.read(File.join(Maglove::Engine.config.block_path, "#{identifier}.haml"))
12
+ end
13
+ end
7
14
  end
8
15
  end
9
16
  end
@@ -14,10 +14,6 @@ module Maglove
14
14
  var(:asset_uri, Maglove::Engine.config.asset_uri)
15
15
  end
16
16
 
17
- def block_path
18
- var(:block_path, Maglove::Engine.config.block_path)
19
- end
20
-
21
17
  def asset(url)
22
18
  "#{asset_uri}/themes/#{theme}/#{url}"
23
19
  end
@@ -35,9 +31,9 @@ module Maglove
35
31
  end
36
32
 
37
33
  def block(identifier, variables = {})
38
- path = File.join(block_path, "#{identifier}.haml")
39
- haml = File.read(path)
40
- Maglove::Engine.render(haml, @variables.merge(variables))
34
+ variables = @variables.merge(variables)
35
+ haml = Maglove::Engine.config.block_resolver.call(identifier, variables)
36
+ Maglove::Engine.render(haml, variables)
41
37
  end
42
38
 
43
39
  def var(key, default = nil)
@@ -1,5 +1,5 @@
1
1
  module Maglove
2
2
  module Engine
3
- VERSION = "2.0.6"
3
+ VERSION = "2.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maglove-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer