opal 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/README.md +1 -1
- data/Rakefile +11 -8
- data/lib/opal.rb +1 -1
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +1 -1
- data/{corelib → opal/core}/array.rb +47 -40
- data/{corelib → opal/core}/basic_object.rb +4 -0
- data/{corelib → opal/core}/boolean.rb +2 -6
- data/{corelib → opal/core}/class.rb +0 -0
- data/{corelib → opal/core}/comparable.rb +0 -0
- data/{corelib → opal/core}/encoding.rb +0 -0
- data/{corelib → opal/core}/enumerable.rb +160 -38
- data/opal/core/enumerator.rb +416 -0
- data/{corelib → opal/core}/error.rb +0 -0
- data/{corelib → opal/core}/hash.rb +38 -48
- data/{corelib → opal/core}/io.rb +13 -9
- data/{corelib → opal/core}/kernel.rb +75 -49
- data/{corelib → opal/core}/main.rb +0 -0
- data/{corelib → opal/core}/match_data.rb +0 -4
- data/{corelib → opal/core}/method.rb +0 -0
- data/{corelib → opal/core}/module.rb +24 -3
- data/{corelib → opal/core}/nil_class.rb +0 -4
- data/{corelib → opal/core}/numeric.rb +3 -4
- data/{corelib → opal/core}/proc.rb +0 -4
- data/{corelib → opal/core}/range.rb +0 -0
- data/{corelib → opal/core}/regexp.rb +0 -4
- data/{corelib → opal/core}/runtime.js +0 -0
- data/{corelib → opal/core}/string.rb +4 -6
- data/{corelib → opal/core}/struct.rb +3 -21
- data/{corelib → opal/core}/time.rb +0 -4
- data/opal/opal.rb +121 -0
- data/spec/corelib/array/select_spec.rb +14 -0
- data/spec/filters/20.rb +4 -0
- data/spec/filters/bugs/enumerable.rb +1 -48
- data/spec/filters/unsupported/enumerator.rb +13 -0
- data/spec/opal/compiler/irb_spec.rb +1 -0
- data/spec/rubyspecs +1 -0
- data/spec/{corelib → stdlib}/native/alias_native_spec.rb +6 -4
- data/spec/{corelib → stdlib}/native/each_spec.rb +3 -1
- data/spec/{corelib → stdlib}/native/element_reference_spec.rb +3 -1
- data/spec/stdlib/native/ext_spec.rb +19 -0
- data/spec/{corelib → stdlib}/native/initialize_spec.rb +4 -4
- data/spec/{corelib → stdlib}/native/method_missing_spec.rb +13 -1
- data/spec/{corelib → stdlib}/native/new_spec.rb +3 -1
- data/stdlib/enumerator.rb +1 -0
- data/stdlib/json.rb +1 -1
- data/stdlib/native.rb +483 -0
- metadata +52 -47
- data/corelib/enumerator.rb +0 -55
- data/corelib/native.rb +0 -270
- data/corelib/opal.rb +0 -88
- data/spec/corelib/native/ext_spec.rb +0 -5
- data/spec/filters/bugs/enumerator.rb +0 -6
data/corelib/opal.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'runtime'
|
2
|
-
require 'module'
|
3
|
-
require 'class'
|
4
|
-
require 'basic_object'
|
5
|
-
require 'kernel'
|
6
|
-
require 'nil_class'
|
7
|
-
require 'boolean'
|
8
|
-
require 'error'
|
9
|
-
require 'regexp'
|
10
|
-
require 'comparable'
|
11
|
-
require 'enumerable'
|
12
|
-
require 'enumerator'
|
13
|
-
require 'array'
|
14
|
-
require 'hash'
|
15
|
-
require 'string'
|
16
|
-
require 'match_data'
|
17
|
-
require 'encoding'
|
18
|
-
require 'numeric'
|
19
|
-
require 'proc'
|
20
|
-
require 'method'
|
21
|
-
require 'range'
|
22
|
-
require 'time'
|
23
|
-
require 'struct'
|
24
|
-
require 'native'
|
25
|
-
require 'io'
|
26
|
-
require 'main'
|
27
|
-
|
28
|
-
# regexp matches
|
29
|
-
$& = $~ = $` = $' = nil
|
30
|
-
|
31
|
-
# stub library path
|
32
|
-
$: = []
|
33
|
-
|
34
|
-
# split lines
|
35
|
-
$/ = "\n"
|
36
|
-
$, = " "
|
37
|
-
|
38
|
-
ARGV = []
|
39
|
-
ARGF = Object.new
|
40
|
-
ENV = {}
|
41
|
-
|
42
|
-
RUBY_PLATFORM = 'opal'
|
43
|
-
RUBY_ENGINE = 'opal'
|
44
|
-
RUBY_VERSION = '1.9.3'
|
45
|
-
RUBY_ENGINE_VERSION = '0.4.4'
|
46
|
-
RUBY_RELEASE_DATE = '2013-08-13'
|
47
|
-
|
48
|
-
module Opal
|
49
|
-
def self.coerce_to(object, type, method)
|
50
|
-
return object if type === object
|
51
|
-
|
52
|
-
unless object.respond_to? method
|
53
|
-
raise TypeError, "no implicit conversion of #{object.class} into #{type}"
|
54
|
-
end
|
55
|
-
|
56
|
-
object.__send__ method
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.truthy?(value)
|
60
|
-
if value
|
61
|
-
true
|
62
|
-
else
|
63
|
-
false
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.falsy?(value)
|
68
|
-
if value
|
69
|
-
false
|
70
|
-
else
|
71
|
-
true
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.destructure(args)
|
76
|
-
%x{
|
77
|
-
if (args.length == 1) {
|
78
|
-
return args[0];
|
79
|
-
}
|
80
|
-
else if (args._isArray) {
|
81
|
-
return args;
|
82
|
-
}
|
83
|
-
else {
|
84
|
-
return $slice.call(args);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
end
|
88
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
opal_filter "Enumerator" do
|
2
|
-
fails "Enumerator.new accepts a block"
|
3
|
-
fails "Enumerator.new ignores block if arg given"
|
4
|
-
fails "Enumerator#rewind works with peek to reset the position"
|
5
|
-
fails "Enumerator#rewind calls the enclosed object's rewind method if one exists"
|
6
|
-
end
|