erbx 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -2
  3. data/lib/erbx.rb +3 -3
  4. data/lib/erbx/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e31bdf6421cebb1ec8d4527078e6459370107053b322536b26caadb41d11810
4
- data.tar.gz: 3d739c286468a2b39f8444343deaaddd7ae19b93e4c4796389080c2b8e244c2a
3
+ metadata.gz: 77cabc09ffc7f07c35fc621d70a07e1fdfb99d6cfbd307eea47db4313fd792ab
4
+ data.tar.gz: 1f6a3fdffe35bbcecd0f8831b809a23cce5018ef7a0f1b3b45b0b7c7a4021fb2
5
5
  SHA512:
6
- metadata.gz: d39a67f89f6c707cbf127911842966fffaaa5ddc5aee7a97278d6381bcb2d20a1473f8531fb68b11e8b9638f887d7227c25213b54f134ff101449d1e4f806608
7
- data.tar.gz: 83b240ba9ab750b85fe6ba064b3c672d277015402502804649fbffa643af20a13b7b395f03a635cf3e92cc6467317ed9b847b8336fb8626a4b82acf03134f6d3
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
+
@@ -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, trim_mode: '%-')
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
@@ -1,3 +1,3 @@
1
1
  class ERBX
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erbx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit