erbx 0.1.0 → 0.1.1
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/README.md +13 -2
- data/lib/erbx.rb +3 -3
- data/lib/erbx/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77cabc09ffc7f07c35fc621d70a07e1fdfb99d6cfbd307eea47db4313fd792ab
|
4
|
+
data.tar.gz: 1f6a3fdffe35bbcecd0f8831b809a23cce5018ef7a0f1b3b45b0b7c7a4021fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f44d821d668e1eba01aa8c9f21196092cee7cbd33557c21439438736e322f29bf231f4311fecad4ac5a18c28a3820784bc299d587e9ca4ec620e540719726f
|
7
|
+
data.tar.gz: e0e0f43db9848e414047a21696644c8eee4482be437a47408cd8bb43d949cdc7b415cd767361df17b7b457a68138eb6b104013e2228c6b40f264e9e171113620
|
data/README.md
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
ERBX is a tiny extension to ERB allowing these tags:
|
9
9
|
|
10
|
-
- `{{ ... }}` as an equivalent to `<%= ... %>`
|
11
|
-
- `(( ... ))` as an equivalent to `<%- ...
|
10
|
+
- `{{ ... }}` as an equivalent to `<%= ... %>` (print ruby code)
|
11
|
+
- `(( ... ))` as an equivalent to `<%- ... -%>` (run ruby code)
|
12
12
|
|
13
13
|
---
|
14
14
|
|
@@ -40,6 +40,8 @@ You rolled {{ dice }}
|
|
40
40
|
(( end ))
|
41
41
|
```
|
42
42
|
|
43
|
+
Render it with `ERBX.new`, which returns an `ERB` instance, after replacing
|
44
|
+
the extended tags - `{{ }}` and `(( ))` - with their `ERB` equivalents.
|
43
45
|
|
44
46
|
```ruby
|
45
47
|
# Render example
|
@@ -55,3 +57,12 @@ puts template.result
|
|
55
57
|
#=> You rolled [4, 2]
|
56
58
|
```
|
57
59
|
|
60
|
+
## Contributing / Support
|
61
|
+
|
62
|
+
If you experience any issue, have a question or a suggestion, or if you wish
|
63
|
+
to contribute, feel free to [open an issue][issues].
|
64
|
+
|
65
|
+
---
|
66
|
+
|
67
|
+
[issues]: https://github.com/DannyBen/erbx/issues
|
68
|
+
|
data/lib/erbx.rb
CHANGED
@@ -3,15 +3,15 @@ require 'erbx/version'
|
|
3
3
|
|
4
4
|
class ERBX
|
5
5
|
class << self
|
6
|
-
attr_reader :content
|
7
|
-
|
8
6
|
def load(filename)
|
9
7
|
new File.read filename
|
10
8
|
end
|
11
9
|
|
12
10
|
def new(content)
|
13
11
|
erb_content = expose_erb_tags content
|
14
|
-
ERB.new(erb_content,
|
12
|
+
ERB.new(erb_content, nil, '%-')
|
13
|
+
# The below syntax requires ruby >= 2.6
|
14
|
+
# ERB.new(erb_content, trim_mode: '%-')
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
data/lib/erbx/version.rb
CHANGED