clutterbuck-erb 0.1.1 → 0.2.0

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: e2e89f8c5fc7403f011cb350b887f0636b43d5f2
4
- data.tar.gz: 910a5cf75d6b16a85e2db8a3cb1f5fd1f93bf100
3
+ metadata.gz: d0a2d0116765eab4d5b2df750ed66472a5500386
4
+ data.tar.gz: d60b680de7ba2cc63bb7649919b6c847e8f0c9b8
5
5
  SHA512:
6
- metadata.gz: c55458f01f496c24532dd476382302800daab494fe804b71aa2c72e27663939ffcc1fa54a71eded5e94af1591abb7441aa81d0a8c32cc9af2ef7f19f748eeca1
7
- data.tar.gz: 801874b278e488f236aced95d16d6199c4b8137fa03ae04f67c9bc5d9487fa4df317e90037d15787b75772be3d4211fad237ba614943a609143f9ea2ff7152fb
6
+ metadata.gz: e701c643284c247cc8ce82237ed663ccd6de2a2d4d141e85ffd36f6b76cb960e5758253fbc8f07cfa98ef62f96fc50b90667433060cdf75b8815dcc65579fad6
7
+ data.tar.gz: e398d7ced4c8ceb861c9e4ddc573234a434cd523c1789184876017bdde9d2829fd0a1cbe30dd59f0c046dd796246957e8183981abe976ba502d066ae9a674626
@@ -22,6 +22,8 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.required_ruby_version = ">= 1.9.3"
24
24
 
25
+ s.add_runtime_dependency 'rack'
26
+
25
27
  s.add_development_dependency 'bundler'
26
28
  s.add_development_dependency 'github-release'
27
29
  s.add_development_dependency 'guard-spork'
@@ -1,4 +1,5 @@
1
1
  require 'erb'
2
+ require 'rack'
2
3
 
3
4
  #:nodoc:
4
5
  module Clutterbuck; end
@@ -51,8 +52,9 @@ module Clutterbuck::ERB
51
52
 
52
53
  #:nodoc:
53
54
  #
54
- # A special (very, *very* special) class which only defines methods for the
55
- # vars that are passed into it.
55
+ # A special (very, *very* special) class which only defines methods for
56
+ # the vars that are passed into it, as well as fundamental HTML escaping
57
+ # methods.
56
58
  #
57
59
  class EvalBinding < BasicObject
58
60
  def initialize(vars)
@@ -77,6 +79,12 @@ module Clutterbuck::ERB
77
79
  instance_eval "def #{k}; @vars[#{k.inspect}]; end"
78
80
  end
79
81
  end
82
+
83
+ # HTML-escape the provided string.
84
+ #
85
+ def h(s)
86
+ ::Rack::Utils.escape_html(s)
87
+ end
80
88
  end
81
89
 
82
90
  # Render an ERB template as a Rack response.
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clutterbuck-erb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement