opulent 1.3.0 → 1.3.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: ed644b0ba2857806a88f0da508087a32b31e85cd
4
- data.tar.gz: 667cb3bfa83b2ea0786aa9427404ebab524fdb36
3
+ metadata.gz: 596ef0227f053f8528322c84b30f62f9cda06106
4
+ data.tar.gz: c8f7380d83175b6eccc89ea6c7145ec99fe0db6a
5
5
  SHA512:
6
- metadata.gz: 55567d695622a6b7c50b45334b851474db72a43b9b7afc2f854125da0b0a6b45f7c06ee2b39f8f3202fba29999b7e36903b9506f6a2fd6b6700e6a0c17ed92cf
7
- data.tar.gz: eae525a670999e15c25ac8e7859d5ec7ca934c0c8d2bbcb001c08eb89608f80851aa2a957bf5aa89ef040141b5b37a94dcab8f672e4323440ad6a2fbe56efec6
6
+ metadata.gz: 664437050fa5a2d6e802ba6858a8c3056a8d8e69add2dd1187858d61c80a97ed06f6a291c0bf0e06665a3d5d033fa411a889a9920fc5736f4d3a55a7f9a9e32e
7
+ data.tar.gz: 0c74ec3b919fdca5cca863c9fd99b59442a94938f139d6183d848106ebc37e3d2723ce7de063152d8deab8fabcbd61f88fb4f6563e4b254199737f18c28226f6
@@ -26,19 +26,6 @@ module Opulent
26
26
  Settings.update_settings settings unless settings.empty?
27
27
  end
28
28
 
29
- # Analyze the input code and check for matching tokens. In case no match was
30
- # found, throw an exception. In special cases, modify the token hash.
31
- #
32
- # @param file [String] The file that needs to be analyzed
33
- # @param locals [Hash] Render call local variables
34
- # @param block [Proc] Processing environment data
35
- #
36
- def render_file(file, locals = {}, &block)
37
- @mode = :file
38
-
39
- render file, locals, &block
40
- end
41
-
42
29
  # Avoid code duplication when layouting is set. When we have a layout, look
43
30
  # in layouts/application by default.
44
31
  #
@@ -52,11 +39,11 @@ module Opulent
52
39
  if Settings[:layouts]
53
40
  layout = locals.has_key?(:layout) ? locals.delete(:layout) : Settings[:default_layout]
54
41
 
55
- get layout, locals, block do
56
- get input, locals, block
42
+ process layout, locals, block do
43
+ process input, locals, block
57
44
  end
58
45
  else
59
- get input, locals, block
46
+ process input, locals, block
60
47
  end
61
48
  end
62
49
 
@@ -67,9 +54,18 @@ module Opulent
67
54
  # @param locals [Hash] Render call local variables
68
55
  # @param block [Proc] Processing environment data
69
56
  #
70
- def get(input, locals, block, &content)
71
- # Get input code
72
- @code = read input
57
+ def process(input, locals, block, &content)
58
+ # Read input parameter based on opening mode. If we have a file mode, we
59
+ # get its path and read the code. We need to reset the mode in case the next
60
+ # render call is on code, not on a file.
61
+ @code = case input
62
+ when Symbol
63
+ @file = File.expand_path "#{input}.op"
64
+ File.read @file
65
+ else
66
+ @file = File.expand_path __FILE__
67
+ input
68
+ end
73
69
 
74
70
  # Get the nodes tree
75
71
  @nodes, @definitions = Parser.new(@file, @definitions).parse @code
@@ -94,22 +90,5 @@ module Opulent
94
90
 
95
91
  return @output
96
92
  end
97
-
98
- # Read input parameter based on opening mode. If we have a file mode, we
99
- # get its path and read the code. We need to reset the mode in case the next
100
- # render call is on code, not on a file.
101
- #
102
- # @param input [String] Input file or code
103
- #
104
- def read(input)
105
- if @mode == :file
106
- @file = File.expand_path "#{input}.op"
107
- @mode = nil unless Settings[:layouts]
108
- return File.read @file
109
- else
110
- @file = File.expand_path __FILE__
111
- return input
112
- end
113
- end
114
93
  end
115
94
  end
@@ -18,7 +18,7 @@ module Opulent
18
18
  @options[:cache] = true
19
19
 
20
20
  # Enable layouts so that we can render with symbols
21
- @options[:layouts] = true
21
+ #@options[:layouts] = true
22
22
 
23
23
  # Set up the rendering engine
24
24
  @engine = ::Opulent.new @options
@@ -1,4 +1,4 @@
1
1
  # @Opulent
2
2
  module Opulent
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opulent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Grozav