baby_erubis 0.1.0 → 1.0.0

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.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 0.1.0 $
4
+ ### $Release: 1.0.0 $
5
5
  ### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
@@ -14,19 +14,18 @@ require 'minitest/autorun'
14
14
  require 'baby_erubis'
15
15
 
16
16
 
17
- def _modify(ruby_code)
18
- if (''.freeze).equal?(''.freeze)
19
- return ruby_code.gsub(/([^'])';/m, "\\1'.freeze;")
20
- else
21
- return ruby_code
22
- end
23
- end
24
-
25
-
26
17
  describe BabyErubis::Template do
27
18
 
28
19
  let(:template) { BabyErubis::Text.new() }
29
20
 
21
+ def _modify(ruby_code)
22
+ if (''.freeze).equal?(''.freeze)
23
+ return ruby_code.gsub(/([^'])';/m, "\\1'.freeze;")
24
+ else
25
+ return ruby_code
26
+ end
27
+ end
28
+
30
29
 
31
30
  describe '#parse()' do
32
31
 
@@ -273,6 +272,14 @@ END
273
272
  assert_equal expected, output
274
273
  end
275
274
 
275
+ it "accepts nil as argument." do
276
+ input = "self.class is <%= self.class %>"
277
+ expected = "self.class is BabyErubis::TemplateContext"
278
+ context = nil
279
+ output = template.from_str(input).render(context)
280
+ assert_equal expected, output
281
+ end
282
+
276
283
  end
277
284
 
278
285
 
@@ -366,6 +373,14 @@ end
366
373
 
367
374
  describe BabyErubis::HtmlTemplate do
368
375
 
376
+ def _modify(ruby_code)
377
+ if (''.freeze).equal?(''.freeze)
378
+ return ruby_code.gsub(/([^'])';/m, "\\1'.freeze;")
379
+ else
380
+ return ruby_code
381
+ end
382
+ end
383
+
369
384
  input = <<'END'
370
385
  <html>
371
386
  <h1><%= @title %></h1>
@@ -389,7 +404,6 @@ _buf = ''; _buf << '<html>
389
404
  </html>
390
405
  '; _buf.to_s
391
406
  END
392
- source = _modify(source)
393
407
  output = <<'END'
394
408
  <html>
395
409
  <h1>Example</h1>
@@ -409,7 +423,7 @@ END
409
423
 
410
424
  it "handles embedded expression with escaping." do
411
425
  tmpl = BabyErubis::Html.new.from_str(input)
412
- assert_equal source, tmpl.src
426
+ assert_equal _modify(source), tmpl.src
413
427
  end
414
428
 
415
429
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baby_erubis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-06 00:00:00.000000000 Z
12
+ date: 2014-05-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'BabyErubis is an yet another eRuby implementation, based on Erubis.
15
15
 
@@ -23,18 +23,21 @@ description: ! 'BabyErubis is an yet another eRuby implementation, based on Erub
23
23
  * Easy to customize
24
24
 
25
25
 
26
- BabyErubis support Ruby 1.9 or higher.
26
+ BabyErubis support Ruby 1.9 or higher, and will work on 1.8 very well.
27
27
 
28
28
  '
29
29
  email: kwa(at)kuwata-lab.com
30
- executables: []
30
+ executables:
31
+ - baby_erubis
31
32
  extensions: []
32
33
  extra_rdoc_files: []
33
34
  files:
34
35
  - lib/baby_erubis.rb
35
36
  - test/context_test.rb
36
37
  - test/run_all.rb
38
+ - test/script_test.rb
37
39
  - test/template_test.rb
40
+ - bin/baby_erubis
38
41
  - README.md
39
42
  - MIT-LICENSE
40
43
  - setup.rb