datagnan 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/datagnan.rb +13 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 590427709ec6e2a71b590660084a9b809b8c002b
|
4
|
+
data.tar.gz: 3e66b7f3db3eb0c9c8f1a9e3b89059a7fde861f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc4abe7040d7fa13bd64027561a5d461ab79366e4f223be74fa563e198b5dec58e6e3a343076a9ddefb604da76559ef88372a5250513755d7eef08d7ae2824d0
|
7
|
+
data.tar.gz: 235bc5f87768487a9cd4fa9a0f820d03f2703e0aab08c2f2d4c18510357d2e1f154572f4b373b1d7a4aed6890f666b23f0d689ba0f46ad73adadf6e27d4e49fc
|
data/lib/datagnan.rb
CHANGED
@@ -357,7 +357,7 @@ end
|
|
357
357
|
# options for parsing and filling the template
|
358
358
|
# @param [Hash] locals
|
359
359
|
# local variables for filling the template
|
360
|
-
def datagnan(
|
360
|
+
def datagnan(template_files, options = {}, local_vars = {})
|
361
361
|
# beginning_time = Time.now
|
362
362
|
## default options
|
363
363
|
options[:scope] ||= self
|
@@ -365,14 +365,19 @@ def datagnan(template_file, options = {}, local_vars = {})
|
|
365
365
|
options[:layout_file] = File.join(options[:views_dir], options[:layout_file] || 'layout.html')
|
366
366
|
(options[:local_vars] ||= {}).merge! local_vars
|
367
367
|
|
368
|
-
|
369
|
-
|
370
|
-
|
368
|
+
html = ""
|
369
|
+
template_files = [template_files] unless template_files.is_a? Array
|
370
|
+
template_files.each do |template_file|
|
371
|
+
## prepare template filename
|
372
|
+
template_file = File.join(options[:views_dir], template_file.to_s)
|
373
|
+
template_file += '.html' unless File.exist? template_file
|
374
|
+
|
375
|
+
## render template
|
376
|
+
html += Datagnan.read(template_file, options)
|
377
|
+
## debug
|
378
|
+
# puts "-- datagnan ( template = #{html} )"
|
379
|
+
end
|
371
380
|
|
372
|
-
## render template
|
373
|
-
html = Datagnan.read(template_file, options)
|
374
|
-
## debug
|
375
|
-
# puts "-- datagnan ( template = #{html} )"
|
376
381
|
## check for layout and wrap template if exist
|
377
382
|
if File.exist? options[:layout_file]
|
378
383
|
options[:local_vars]['template'] = { 'html' => html }
|