nrser 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20bf26571dcbd1728392f3c893af504e485766f7
4
- data.tar.gz: eb0517a62c2a5388b3a630d4e2bbc7054efbbfda
3
+ metadata.gz: 4fc19984de203cad2890315d0e0bafec1f58aa7d
4
+ data.tar.gz: 3c6a1de1643d012fb402d52a10c76ca993441024
5
5
  SHA512:
6
- metadata.gz: b4002c2dfaeae3ea5c9ca01f8cc34fc5c0800452668040cf5367e2eb20ce1521f25466cca25f5fa807a3d5a858b0b88392a50756d0b116464391bcb27789f5ac
7
- data.tar.gz: e1b2af920dfd54ac531d07ba34fe86cf1993311affe4958cc470d900af8b587d437b390c881f1ef93f951e1567c9e75b2b5d1e3001d8aca1f40d7b46e56f914c
6
+ metadata.gz: 2095704201da4fe33298020d606e7340bf641b53a9fe6a062be210cf5bd2638fea6d5aaedc3955e82e0a8de347dfc440d0c10bd527b53fec9d25b36c70e1307a
7
+ data.tar.gz: 2eb59417a612656f0d3f4ad9d4cfc44d74bcecc17f1ac24d37049c6c2a8df79066d1e71d877dcd53955e399294dc9938ab8467e67316523f6cf7ed0efa75eba2
data/lib/nrser.rb CHANGED
@@ -52,12 +52,12 @@ module NRSER
52
52
  out.join
53
53
  end # filter_repeated_blank_lines
54
54
 
55
- def template bnd, str
55
+ def erb bnd, str
56
56
  require 'erb'
57
57
  filter_repeated_blank_lines ERB.new(dedent(str)).result(bnd)
58
- end # template
58
+ end # erb
59
59
 
60
- alias_method :tpl, :template
60
+ alias_method :template, :erb
61
61
 
62
62
  def format_exception e
63
63
  "#{ e.message } (#{ e.class }):\n #{ e.backtrace.join("\n ") }"
@@ -1,20 +1,15 @@
1
1
  module NRSER
2
- module KernelRefinements
3
- def tpl *args
4
- NRSER::template *args
5
- end
6
- end
7
-
8
2
  refine Object do
9
- include KernelRefinements
10
-
11
3
  def pipe
12
4
  yield self
13
5
  end
14
-
15
6
  end
16
7
 
17
8
  refine String do
9
+ def squish
10
+ NRSER.squish self
11
+ end
12
+
18
13
  def unblock
19
14
  NRSER.unblock self
20
15
  end
@@ -37,4 +32,10 @@ module NRSER
37
32
  NRSER.format_exception self
38
33
  end
39
34
  end
40
- end # NRSER
35
+
36
+ refine Binding do
37
+ def erb str
38
+ NRSER.template self, str
39
+ end
40
+ end
41
+ end # NRSER
data/lib/nrser/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module NRSER
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
data/nrser.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.6"
20
+ spec.add_development_dependency "bundler", "~> 1.5"
21
21
  spec.add_development_dependency "rake"
22
22
  spec.add_development_dependency "rspec"
23
23
  end
@@ -3,10 +3,10 @@ require 'nrser/refinements'
3
3
 
4
4
  using NRSER
5
5
 
6
- describe 'NRSER.template' do
7
- it "refines tpl in object like it was defined in Kernel" do
6
+ describe 'Binding#erb' do
7
+ it "refines NRSER.erb into Binding" do
8
8
  expect(
9
- tpl binding, <<-BLOCK
9
+ binding.erb <<-BLOCK
10
10
  hey
11
11
  BLOCK
12
12
  ).to eq <<-BLOCK.dedent
@@ -18,7 +18,7 @@ describe 'NRSER.template' do
18
18
  x = 1
19
19
 
20
20
  expect(
21
- tpl binding, <<-BLOCK
21
+ binding.erb <<-BLOCK
22
22
  x is <%= x %>
23
23
  BLOCK
24
24
  ).to eq <<-BLOCK.dedent
@@ -27,7 +27,7 @@ describe 'NRSER.template' do
27
27
  end
28
28
 
29
29
  it "handles edge cases" do
30
- expect( tpl binding, '' ).to eq ''
31
- expect( tpl binding, 'blah' ).to eq 'blah'
30
+ expect( binding.erb '' ).to eq ''
31
+ expect( binding.erb 'blah' ).to eq 'blah'
32
32
  end
33
- end # template
33
+ end # Binding#erb
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nrser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-07 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -74,9 +74,9 @@ files:
74
74
  - spec/nrser/dedent_spec.rb
75
75
  - spec/nrser/format_exception_spec.rb
76
76
  - spec/nrser/indent_spec.rb
77
+ - spec/nrser/refinements/erb_spec.rb
77
78
  - spec/nrser/refinements/format_exception_spec.rb
78
79
  - spec/nrser/refinements/indent_spec.rb
79
- - spec/nrser/refinements/template_spec.rb
80
80
  - spec/nrser/refinements/truncate_spec.rb
81
81
  - spec/nrser/template_spec.rb
82
82
  - spec/nrser/truncate_spec.rb
@@ -112,9 +112,9 @@ test_files:
112
112
  - spec/nrser/dedent_spec.rb
113
113
  - spec/nrser/format_exception_spec.rb
114
114
  - spec/nrser/indent_spec.rb
115
+ - spec/nrser/refinements/erb_spec.rb
115
116
  - spec/nrser/refinements/format_exception_spec.rb
116
117
  - spec/nrser/refinements/indent_spec.rb
117
- - spec/nrser/refinements/template_spec.rb
118
118
  - spec/nrser/refinements/truncate_spec.rb
119
119
  - spec/nrser/template_spec.rb
120
120
  - spec/nrser/truncate_spec.rb