safemode 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of safemode might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -27,7 +27,7 @@ module Safemode
27
27
  end
28
28
 
29
29
  # these methods are allowed in all classes if they are present
30
- @@default_methods = %w( % & * ** + +@ - -@ / < << <= <=> == === > >= >> ^ | ~
30
+ @@default_methods = %w( % & * ** + +@ - -@ / < << <= <=> != == === > >= >> ^ | ~
31
31
  eql? equal? new methods is_a? kind_of? nil?
32
32
  [] []= to_a to_jail to_s inspect to_param )
33
33
 
@@ -36,6 +36,7 @@ module Safemode
36
36
  receiver = jail process_call_receiver(exp)
37
37
  name = exp.shift
38
38
  args = process_call_args(exp)
39
+
39
40
  process_call_code(receiver, name, args)
40
41
  end
41
42
 
@@ -149,7 +150,7 @@ module Safemode
149
150
 
150
151
  def process_call_code(receiver, name, args)
151
152
  case name
152
- when :<=>, :==, :<, :>, :<=, :>=, :-, :+, :*, :/, :%, :<<, :>>, :** then
153
+ when :<=>, :==, "!=".to_sym, :<, :>, :<=, :>=, :-, :+, :*, :/, :%, :<<, :>>, :** then
153
154
  "(#{receiver} #{name} #{args})"
154
155
  when :[] then
155
156
  "#{receiver}[#{args}]"
@@ -195,7 +196,6 @@ module Safemode
195
196
  r = "if #{c} then\n#{indent(t)}\n"
196
197
  r << "else\n#{indent(f)}\n" if f
197
198
  r << "end"
198
-
199
199
  r
200
200
  else
201
201
  # unless expand then
data/safemode.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "safemode"
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sven Fuchs", "Peter Cooper", "Matthias Viehweger", "Kingsley Hendrickse", "Ohad Levy", "Dmitri Dolguikh"]
12
- s.date = "2012-12-10"
12
+ s.date = "2013-02-11"
13
13
  s.description = "A library for safe evaluation of Ruby code based on RubyParser and Ruby2Ruby. Provides Rails ActionView template handlers for ERB and Haml."
14
14
  s.email = "ohadlevy@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -11,7 +11,9 @@ class TestERBEval < Test::Unit::TestCase
11
11
  end
12
12
 
13
13
  def test_some_stuff_that_should_work
14
- ['"test".upcase', '10.succ', '10.times{}', '[1,2,3].each{|a| a + 1}', 'true ? 1 : 0', 'a = 1'].each do |code|
14
+ ['"test".upcase', '10.succ', '10.times{}', '[1,2,3].each{|a| a + 1}',
15
+ 'true ? 1 : 0', 'a = 1', 'unless "a" == "b"; "false"; end',
16
+ 'if "a" != "b"; "true"; end'].each do |code|
15
17
  code = ERB.new("<%= #{code} %>").src
16
18
  assert_nothing_raised{ @box.eval code }
17
19
  end
@@ -10,7 +10,9 @@ class TestSafemodeEval < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  def test_some_stuff_that_should_work
13
- ['"test".upcase', '10.succ', '10.times{}', '[1,2,3].each{|a| a + 1}', 'true ? 1 : 0', 'a = 1'].each do |code|
13
+ ['"test".upcase', '10.succ', '10.times{}', '[1,2,3].each{|a| a + 1}',
14
+ 'true ? 1 : 0', 'a = 1', 'if "a" != "b"; "true"; end',
15
+ 'if "a" == "b"; "true"; end'].each do |code|
14
16
  assert_nothing_raised{ @box.eval code }
15
17
  end
16
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safemode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2012-12-10 00:00:00.000000000 Z
17
+ date: 2013-02-11 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: sexp_processor
@@ -244,7 +244,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  segments:
246
246
  - 0
247
- hash: -963555767727141691
247
+ hash: -3228505214304288424
248
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  none: false
250
250
  requirements: