armadillo 0.0.4 → 0.0.5
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/armadillo.gemspec +1 -1
- data/lib/armadillo.rb +2 -2
- data/spec/template_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 708c0aa944b119c3a39a0872be76237cfe0e23be
|
4
|
+
data.tar.gz: 30c62970324900dd052ef97c4911b81c1424dcbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f93b5bad07de610b17bb5596c4305b392d1d0415a4cd0244000615bacaefff6458cb38727658a5a4495f5a8a95cbdc05efb17911a2673c844c0fb7de45d8cdb
|
7
|
+
data.tar.gz: b7146c572401f76bc4e74f5796fee206ceccdf2534d284198dc5be9ecaf3ee1822218b902ab68137fed249e523161c5d8579a06731b30a23b68e7c95bf47ed32
|
data/armadillo.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "armadillo"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.5"
|
4
4
|
s.summary = "Template inheritance with ERB templates"
|
5
5
|
s.description = "A small library for Django-like template inheritance adapted for ERB"
|
6
6
|
s.authors = ["Sebastian Borrazas"]
|
data/lib/armadillo.rb
CHANGED
@@ -4,7 +4,7 @@ require "delegate"
|
|
4
4
|
|
5
5
|
module Armadillo
|
6
6
|
|
7
|
-
VERSION = "0.0.
|
7
|
+
VERSION = "0.0.5"
|
8
8
|
|
9
9
|
DEFAULT_OPTIONS = {
|
10
10
|
:default_encoding => Encoding.default_external,
|
@@ -141,7 +141,7 @@ module Armadillo
|
|
141
141
|
# @return [String]
|
142
142
|
# @api public
|
143
143
|
def self.render(template_path, locals = {}, options = {})
|
144
|
-
scope = options.
|
144
|
+
scope = options.fetch(:scope) { Object.new }
|
145
145
|
context = TemplateContext.new(scope, options)
|
146
146
|
_render(template_path, locals, context, options)
|
147
147
|
end
|
data/spec/template_spec.rb
CHANGED
@@ -88,6 +88,21 @@ describe Armadillo do
|
|
88
88
|
"<h2>Subtitle</h2>"
|
89
89
|
])
|
90
90
|
end
|
91
|
+
|
92
|
+
it "uses the same scope object" do
|
93
|
+
obj = Object.new
|
94
|
+
def obj.some_text
|
95
|
+
"text!"
|
96
|
+
end
|
97
|
+
content = Armadillo.render("with_sub_template2.html", {}, {
|
98
|
+
:base_path => TEMPLATES_PATH,
|
99
|
+
:escape_html => true,
|
100
|
+
:scope => obj
|
101
|
+
})
|
102
|
+
assert_lines_match(content, [
|
103
|
+
"<h2>text!</h2>"
|
104
|
+
])
|
105
|
+
end
|
91
106
|
end
|
92
107
|
end
|
93
108
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: armadillo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Borrazas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubis
|