rubyless 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/ruby_less/basic_types.rb +1 -1
- data/lib/ruby_less/info.rb +1 -1
- data/lib/ruby_less/processor.rb +6 -0
- data/lib/ruby_less/signature_hash.rb +2 -1
- data/rubyless.gemspec +2 -2
- data/test/RubyLess/basic.yml +12 -0
- data/test/RubyLess_test.rb +2 -0
- metadata +4 -4
data/History.txt
CHANGED
@@ -13,7 +13,7 @@ class StringDictionary
|
|
13
13
|
safe_method ['[]', Symbol] => {:class => String, :nil => true}
|
14
14
|
end
|
15
15
|
|
16
|
-
RubyLess::SafeClass.safe_literal_class Fixnum => Number, Float => Number, Symbol => Symbol, Regexp => Regexp
|
16
|
+
RubyLess::SafeClass.safe_literal_class Fixnum => Number, Float => Number, Symbol => Symbol, Regexp => Regexp, Range => Range
|
17
17
|
RubyLess::SafeClass.safe_method_for( Number,
|
18
18
|
[:==, Number] => Boolean, [:< , Number] => Boolean, [:> , Number] => Boolean,
|
19
19
|
[:<=, Number] => Boolean, [:>=, Number] => Boolean, [:- , Number] => Number,
|
data/lib/ruby_less/info.rb
CHANGED
data/lib/ruby_less/processor.rb
CHANGED
@@ -175,6 +175,12 @@ module RubyLess
|
|
175
175
|
def process_dstr(exp)
|
176
176
|
t "\"#{parse_dstr(exp)}\"", String
|
177
177
|
end
|
178
|
+
|
179
|
+
def process_dot2(exp)
|
180
|
+
a = process(exp.shift)
|
181
|
+
b = process(exp.shift)
|
182
|
+
t "(#{a}..#{b})", Range
|
183
|
+
end
|
178
184
|
|
179
185
|
def process_evstr(exp)
|
180
186
|
exp.empty? ? t('', String) : process(exp.shift)
|
data/rubyless.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubyless}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gaspard Bucher"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2012-09-24}
|
13
13
|
s.description = %q{RubyLess is an interpreter for "safe ruby". The idea is to transform some "unsafe" ruby code into safe, type checked ruby, eventually rewriting some variables or methods.}
|
14
14
|
s.email = %q{gaspard@teti.ch}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/RubyLess/basic.yml
CHANGED
@@ -22,6 +22,18 @@ symbol:
|
|
22
22
|
src: ":foobar"
|
23
23
|
sxp: 's(:lit, :foobar)'
|
24
24
|
|
25
|
+
range_lit:
|
26
|
+
src: '(0..4).to_a'
|
27
|
+
sxp: 's(:call, s(:lit, 0..4), :to_a, s(:arglist))'
|
28
|
+
tem: '[0, 1, 2, 3, 4]'
|
29
|
+
|
30
|
+
range_to_a:
|
31
|
+
context:
|
32
|
+
x: 4
|
33
|
+
src: '(0..id).to_a'
|
34
|
+
sxp: "s(:call, s(:dot2, s(:lit, 0), s(:call, nil, :id, s(:arglist))), :to_a, s(:arglist))"
|
35
|
+
tem: '(0..node.zip).to_a'
|
36
|
+
|
25
37
|
rewrite_variables:
|
26
38
|
src: "!prev.ancestor?(main) && !node.ancestor?(main)"
|
27
39
|
tem: "(not previous.ancestor?(@node) and not node.ancestor?(@node))"
|
data/test/RubyLess_test.rb
CHANGED
@@ -56,6 +56,8 @@ class RubyLessTest < Test::Unit::TestCase
|
|
56
56
|
safe_method_for Array, [:map, Symbol] => {:method => 'nil', :class => nil, :pre_processor => self.map_proc}
|
57
57
|
|
58
58
|
safe_method_for Array, [:join, String] => {:method => 'join', :class => String, :pre_processor => true}
|
59
|
+
|
60
|
+
safe_method_for Range, :to_a => {:class => [Number], :pre_processor => true}
|
59
61
|
|
60
62
|
safe_method_for Hash, :to_param => String
|
61
63
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 7
|
10
|
+
version: 0.8.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gaspard Bucher
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-09-24 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|