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 +4 -4
- data/lib/nrser.rb +3 -3
- data/lib/nrser/refinements.rb +11 -10
- data/lib/nrser/version.rb +1 -1
- data/nrser.gemspec +1 -1
- data/spec/nrser/refinements/{template_spec.rb → erb_spec.rb} +7 -7
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fc19984de203cad2890315d0e0bafec1f58aa7d
|
4
|
+
data.tar.gz: 3c6a1de1643d012fb402d52a10c76ca993441024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
55
|
+
def erb bnd, str
|
56
56
|
require 'erb'
|
57
57
|
filter_repeated_blank_lines ERB.new(dedent(str)).result(bnd)
|
58
|
-
end #
|
58
|
+
end # erb
|
59
59
|
|
60
|
-
alias_method :
|
60
|
+
alias_method :template, :erb
|
61
61
|
|
62
62
|
def format_exception e
|
63
63
|
"#{ e.message } (#{ e.class }):\n #{ e.backtrace.join("\n ") }"
|
data/lib/nrser/refinements.rb
CHANGED
@@ -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
|
-
|
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
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.
|
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 '
|
7
|
-
it "refines
|
6
|
+
describe 'Binding#erb' do
|
7
|
+
it "refines NRSER.erb into Binding" do
|
8
8
|
expect(
|
9
|
-
|
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
|
-
|
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(
|
31
|
-
expect(
|
30
|
+
expect( binding.erb '' ).to eq ''
|
31
|
+
expect( binding.erb 'blah' ).to eq 'blah'
|
32
32
|
end
|
33
|
-
end #
|
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.
|
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-
|
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.
|
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.
|
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
|