mustang 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -1
- data/Rakefile +1 -1
- data/TODO.md +2 -1
- data/ext/v8/extconf.rb +3 -1
- data/ext/v8/v8_array.cpp +2 -0
- data/ext/v8/v8_context.cpp +32 -5
- data/ext/v8/v8_date.cpp +1 -0
- data/ext/v8/v8_external.cpp +1 -0
- data/ext/v8/v8_function.cpp +3 -0
- data/ext/v8/v8_integer.cpp +1 -0
- data/ext/v8/v8_macros.h +6 -0
- data/ext/v8/v8_main.cpp +3 -1
- data/ext/v8/v8_number.cpp +1 -0
- data/ext/v8/v8_object.cpp +2 -0
- data/ext/v8/v8_regexp.cpp +1 -0
- data/ext/v8/v8_string.cpp +1 -0
- data/ext/v8/v8_value.cpp +2 -0
- data/lib/mustang.rb +20 -27
- data/lib/mustang/context.rb +0 -26
- data/lib/{core_ext → mustang/core_ext}/class.rb +1 -1
- data/lib/{core_ext → mustang/core_ext}/object.rb +2 -4
- data/lib/{core_ext → mustang/core_ext}/symbol.rb +0 -0
- data/lib/{support → mustang/support}/delegated.rb +0 -0
- data/lib/mustang/v8/array.rb +21 -0
- data/lib/mustang/v8/context.rb +15 -0
- data/lib/mustang/v8/date.rb +20 -0
- data/lib/mustang/v8/error.rb +17 -0
- data/lib/mustang/v8/external.rb +16 -0
- data/lib/mustang/v8/function.rb +13 -0
- data/lib/mustang/v8/integer.rb +16 -0
- data/lib/mustang/v8/number.rb +16 -0
- data/lib/mustang/v8/object.rb +66 -0
- data/lib/mustang/v8/regexp.rb +23 -0
- data/lib/mustang/v8/string.rb +27 -0
- data/mustang.gemspec +1 -1
- data/spec/{core_ext → mustang/core_ext}/class_spec.rb +3 -3
- data/spec/{core_ext → mustang/core_ext}/object_spec.rb +3 -3
- data/spec/{core_ext → mustang/core_ext}/symbol_spec.rb +1 -1
- data/spec/{v8 → mustang/v8}/array_spec.rb +12 -5
- data/spec/{v8 → mustang/v8}/cast_spec.rb +10 -10
- data/spec/{v8 → mustang/v8}/context_spec.rb +52 -6
- data/spec/{v8 → mustang/v8}/data_spec.rb +4 -4
- data/spec/{v8 → mustang/v8}/date_spec.rb +12 -5
- data/spec/{v8 → mustang/v8}/empty_spec.rb +4 -4
- data/spec/{v8 → mustang/v8}/errors_spec.rb +9 -9
- data/spec/{v8 → mustang/v8}/external_spec.rb +14 -7
- data/spec/{v8 → mustang/v8}/function_spec.rb +20 -13
- data/spec/{v8 → mustang/v8}/integer_spec.rb +13 -6
- data/spec/{v8 → mustang/v8}/main_spec.rb +2 -2
- data/spec/{v8 → mustang/v8}/null_spec.rb +4 -4
- data/spec/{v8 → mustang/v8}/number_spec.rb +5 -5
- data/spec/{v8 → mustang/v8}/object_spec.rb +13 -6
- data/spec/mustang/v8/primitive_spec.rb +9 -0
- data/spec/{v8 → mustang/v8}/regexp_spec.rb +12 -5
- data/spec/{v8 → mustang/v8}/string_spec.rb +12 -5
- data/spec/{v8 → mustang/v8}/undefined_spec.rb +4 -4
- data/spec/mustang/v8/value_spec.rb +222 -0
- data/spec/spec_helper.rb +1 -1
- metadata +91 -62
- data/lib/v8/array.rb +0 -21
- data/lib/v8/context.rb +0 -13
- data/lib/v8/date.rb +0 -20
- data/lib/v8/error.rb +0 -15
- data/lib/v8/external.rb +0 -16
- data/lib/v8/function.rb +0 -11
- data/lib/v8/integer.rb +0 -16
- data/lib/v8/number.rb +0 -16
- data/lib/v8/object.rb +0 -66
- data/lib/v8/regexp.rb +0 -23
- data/lib/v8/string.rb +0 -27
- data/spec/v8/primitive_spec.rb +0 -9
- data/spec/v8/value_spec.rb +0 -215
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mustang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Chris Kowalik
|
@@ -11,7 +16,8 @@ autorequire:
|
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
18
|
|
14
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-06 00:00:00 -03:00
|
20
|
+
default_executable:
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: ore-tasks
|
@@ -21,6 +27,10 @@ dependencies:
|
|
21
27
|
requirements:
|
22
28
|
- - ~>
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 4
|
24
34
|
version: "0.4"
|
25
35
|
type: :development
|
26
36
|
version_requirements: *id001
|
@@ -32,6 +42,10 @@ dependencies:
|
|
32
42
|
requirements:
|
33
43
|
- - ~>
|
34
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
35
49
|
version: "2.0"
|
36
50
|
type: :development
|
37
51
|
version_requirements: *id002
|
@@ -43,6 +57,10 @@ dependencies:
|
|
43
57
|
requirements:
|
44
58
|
- - ~>
|
45
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 25
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
- 9
|
46
64
|
version: "0.9"
|
47
65
|
type: :development
|
48
66
|
version_requirements: *id003
|
@@ -54,6 +72,10 @@ dependencies:
|
|
54
72
|
requirements:
|
55
73
|
- - ~>
|
56
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 5
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
- 7
|
57
79
|
version: "0.7"
|
58
80
|
type: :development
|
59
81
|
version_requirements: *id004
|
@@ -107,50 +129,50 @@ files:
|
|
107
129
|
- ext/v8/v8_string.h
|
108
130
|
- ext/v8/v8_value.cpp
|
109
131
|
- ext/v8/v8_value.h
|
110
|
-
- lib/core_ext/class.rb
|
111
|
-
- lib/core_ext/object.rb
|
112
|
-
- lib/core_ext/symbol.rb
|
113
132
|
- lib/mustang.rb
|
114
133
|
- lib/mustang/context.rb
|
134
|
+
- lib/mustang/core_ext/class.rb
|
135
|
+
- lib/mustang/core_ext/object.rb
|
136
|
+
- lib/mustang/core_ext/symbol.rb
|
115
137
|
- lib/mustang/errors.rb
|
116
|
-
- lib/support/delegated.rb
|
117
|
-
- lib/v8/array.rb
|
118
|
-
- lib/v8/context.rb
|
119
|
-
- lib/v8/date.rb
|
120
|
-
- lib/v8/error.rb
|
121
|
-
- lib/v8/external.rb
|
122
|
-
- lib/v8/function.rb
|
123
|
-
- lib/v8/integer.rb
|
124
|
-
- lib/v8/number.rb
|
125
|
-
- lib/v8/object.rb
|
126
|
-
- lib/v8/regexp.rb
|
127
|
-
- lib/v8/string.rb
|
138
|
+
- lib/mustang/support/delegated.rb
|
139
|
+
- lib/mustang/v8/array.rb
|
140
|
+
- lib/mustang/v8/context.rb
|
141
|
+
- lib/mustang/v8/date.rb
|
142
|
+
- lib/mustang/v8/error.rb
|
143
|
+
- lib/mustang/v8/external.rb
|
144
|
+
- lib/mustang/v8/function.rb
|
145
|
+
- lib/mustang/v8/integer.rb
|
146
|
+
- lib/mustang/v8/number.rb
|
147
|
+
- lib/mustang/v8/object.rb
|
148
|
+
- lib/mustang/v8/regexp.rb
|
149
|
+
- lib/mustang/v8/string.rb
|
128
150
|
- mustang.gemspec
|
129
|
-
- spec/core_ext/class_spec.rb
|
130
|
-
- spec/core_ext/object_spec.rb
|
131
|
-
- spec/core_ext/symbol_spec.rb
|
132
151
|
- spec/fixtures/test1.js
|
133
152
|
- spec/fixtures/test2.js
|
153
|
+
- spec/mustang/core_ext/class_spec.rb
|
154
|
+
- spec/mustang/core_ext/object_spec.rb
|
155
|
+
- spec/mustang/core_ext/symbol_spec.rb
|
156
|
+
- spec/mustang/v8/array_spec.rb
|
157
|
+
- spec/mustang/v8/cast_spec.rb
|
158
|
+
- spec/mustang/v8/context_spec.rb
|
159
|
+
- spec/mustang/v8/data_spec.rb
|
160
|
+
- spec/mustang/v8/date_spec.rb
|
161
|
+
- spec/mustang/v8/empty_spec.rb
|
162
|
+
- spec/mustang/v8/errors_spec.rb
|
163
|
+
- spec/mustang/v8/external_spec.rb
|
164
|
+
- spec/mustang/v8/function_spec.rb
|
165
|
+
- spec/mustang/v8/integer_spec.rb
|
166
|
+
- spec/mustang/v8/main_spec.rb
|
167
|
+
- spec/mustang/v8/null_spec.rb
|
168
|
+
- spec/mustang/v8/number_spec.rb
|
169
|
+
- spec/mustang/v8/object_spec.rb
|
170
|
+
- spec/mustang/v8/primitive_spec.rb
|
171
|
+
- spec/mustang/v8/regexp_spec.rb
|
172
|
+
- spec/mustang/v8/string_spec.rb
|
173
|
+
- spec/mustang/v8/undefined_spec.rb
|
174
|
+
- spec/mustang/v8/value_spec.rb
|
134
175
|
- spec/spec_helper.rb
|
135
|
-
- spec/v8/array_spec.rb
|
136
|
-
- spec/v8/cast_spec.rb
|
137
|
-
- spec/v8/context_spec.rb
|
138
|
-
- spec/v8/data_spec.rb
|
139
|
-
- spec/v8/date_spec.rb
|
140
|
-
- spec/v8/empty_spec.rb
|
141
|
-
- spec/v8/errors_spec.rb
|
142
|
-
- spec/v8/external_spec.rb
|
143
|
-
- spec/v8/function_spec.rb
|
144
|
-
- spec/v8/integer_spec.rb
|
145
|
-
- spec/v8/main_spec.rb
|
146
|
-
- spec/v8/null_spec.rb
|
147
|
-
- spec/v8/number_spec.rb
|
148
|
-
- spec/v8/object_spec.rb
|
149
|
-
- spec/v8/primitive_spec.rb
|
150
|
-
- spec/v8/regexp_spec.rb
|
151
|
-
- spec/v8/string_spec.rb
|
152
|
-
- spec/v8/undefined_spec.rb
|
153
|
-
- spec/v8/value_spec.rb
|
154
176
|
- vendor/v8/.gitignore
|
155
177
|
- vendor/v8/AUTHORS
|
156
178
|
- vendor/v8/ChangeLog
|
@@ -1577,6 +1599,7 @@ files:
|
|
1577
1599
|
- vendor/v8/tools/visual_studio/v8_x64.vcproj
|
1578
1600
|
- vendor/v8/tools/visual_studio/x64.vsprops
|
1579
1601
|
- vendor/v8/tools/windows-tick-processor.bat
|
1602
|
+
has_rdoc: true
|
1580
1603
|
homepage: http://github.com/nu7hatch/mustang
|
1581
1604
|
licenses:
|
1582
1605
|
- MIT
|
@@ -1591,43 +1614,49 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1591
1614
|
requirements:
|
1592
1615
|
- - ">="
|
1593
1616
|
- !ruby/object:Gem::Version
|
1617
|
+
hash: 3
|
1618
|
+
segments:
|
1619
|
+
- 0
|
1594
1620
|
version: "0"
|
1595
1621
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1596
1622
|
none: false
|
1597
1623
|
requirements:
|
1598
1624
|
- - ">="
|
1599
1625
|
- !ruby/object:Gem::Version
|
1626
|
+
hash: 3
|
1627
|
+
segments:
|
1628
|
+
- 0
|
1600
1629
|
version: "0"
|
1601
1630
|
requirements: []
|
1602
1631
|
|
1603
1632
|
rubyforge_project:
|
1604
|
-
rubygems_version: 1.
|
1633
|
+
rubygems_version: 1.4.1
|
1605
1634
|
signing_key:
|
1606
1635
|
specification_version: 3
|
1607
1636
|
summary: Awesome V8 JavaScript engine embedded into the Ruby's shiny body
|
1608
1637
|
test_files:
|
1609
|
-
- spec/core_ext/class_spec.rb
|
1610
|
-
- spec/core_ext/object_spec.rb
|
1611
|
-
- spec/core_ext/symbol_spec.rb
|
1612
1638
|
- spec/fixtures/test1.js
|
1613
1639
|
- spec/fixtures/test2.js
|
1640
|
+
- spec/mustang/core_ext/class_spec.rb
|
1641
|
+
- spec/mustang/core_ext/object_spec.rb
|
1642
|
+
- spec/mustang/core_ext/symbol_spec.rb
|
1643
|
+
- spec/mustang/v8/array_spec.rb
|
1644
|
+
- spec/mustang/v8/cast_spec.rb
|
1645
|
+
- spec/mustang/v8/context_spec.rb
|
1646
|
+
- spec/mustang/v8/data_spec.rb
|
1647
|
+
- spec/mustang/v8/date_spec.rb
|
1648
|
+
- spec/mustang/v8/empty_spec.rb
|
1649
|
+
- spec/mustang/v8/errors_spec.rb
|
1650
|
+
- spec/mustang/v8/external_spec.rb
|
1651
|
+
- spec/mustang/v8/function_spec.rb
|
1652
|
+
- spec/mustang/v8/integer_spec.rb
|
1653
|
+
- spec/mustang/v8/main_spec.rb
|
1654
|
+
- spec/mustang/v8/null_spec.rb
|
1655
|
+
- spec/mustang/v8/number_spec.rb
|
1656
|
+
- spec/mustang/v8/object_spec.rb
|
1657
|
+
- spec/mustang/v8/primitive_spec.rb
|
1658
|
+
- spec/mustang/v8/regexp_spec.rb
|
1659
|
+
- spec/mustang/v8/string_spec.rb
|
1660
|
+
- spec/mustang/v8/undefined_spec.rb
|
1661
|
+
- spec/mustang/v8/value_spec.rb
|
1614
1662
|
- spec/spec_helper.rb
|
1615
|
-
- spec/v8/array_spec.rb
|
1616
|
-
- spec/v8/cast_spec.rb
|
1617
|
-
- spec/v8/context_spec.rb
|
1618
|
-
- spec/v8/data_spec.rb
|
1619
|
-
- spec/v8/date_spec.rb
|
1620
|
-
- spec/v8/empty_spec.rb
|
1621
|
-
- spec/v8/errors_spec.rb
|
1622
|
-
- spec/v8/external_spec.rb
|
1623
|
-
- spec/v8/function_spec.rb
|
1624
|
-
- spec/v8/integer_spec.rb
|
1625
|
-
- spec/v8/main_spec.rb
|
1626
|
-
- spec/v8/null_spec.rb
|
1627
|
-
- spec/v8/number_spec.rb
|
1628
|
-
- spec/v8/object_spec.rb
|
1629
|
-
- spec/v8/primitive_spec.rb
|
1630
|
-
- spec/v8/regexp_spec.rb
|
1631
|
-
- spec/v8/string_spec.rb
|
1632
|
-
- spec/v8/undefined_spec.rb
|
1633
|
-
- spec/v8/value_spec.rb
|
data/lib/v8/array.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'support/delegated'
|
2
|
-
|
3
|
-
module V8
|
4
|
-
class Array
|
5
|
-
include Comparable
|
6
|
-
include Enumerable
|
7
|
-
include Delegated
|
8
|
-
|
9
|
-
def <=>(other)
|
10
|
-
to_a <=> other
|
11
|
-
end
|
12
|
-
|
13
|
-
def each(*args, &block)
|
14
|
-
to_a.each(*args, &block)
|
15
|
-
end
|
16
|
-
|
17
|
-
def delegate
|
18
|
-
to_a
|
19
|
-
end
|
20
|
-
end # Array
|
21
|
-
end # V8
|
data/lib/v8/context.rb
DELETED
data/lib/v8/date.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'support/delegated'
|
2
|
-
|
3
|
-
module V8
|
4
|
-
class Date
|
5
|
-
include Comparable
|
6
|
-
include Delegated
|
7
|
-
|
8
|
-
def to_time
|
9
|
-
Time.at(to_i);
|
10
|
-
end
|
11
|
-
|
12
|
-
def <=>(other)
|
13
|
-
to_time <=> other
|
14
|
-
end
|
15
|
-
|
16
|
-
def delegate
|
17
|
-
to_time
|
18
|
-
end
|
19
|
-
end # Date
|
20
|
-
end # V8
|
data/lib/v8/error.rb
DELETED
data/lib/v8/external.rb
DELETED
data/lib/v8/function.rb
DELETED
data/lib/v8/integer.rb
DELETED
data/lib/v8/number.rb
DELETED
data/lib/v8/object.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'support/delegated'
|
2
|
-
|
3
|
-
module V8
|
4
|
-
class Object
|
5
|
-
class << self
|
6
|
-
alias_method :native_new, :new
|
7
|
-
|
8
|
-
def new(*args, &block)
|
9
|
-
res = native_new(*args)
|
10
|
-
res.send(:reflect_from, args.first)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def respond_to?(meth)
|
15
|
-
!self[meth].undefined? or super
|
16
|
-
end
|
17
|
-
|
18
|
-
def method_missing(meth, *args, &block)
|
19
|
-
if respond_to?(meth)
|
20
|
-
property = self[meth]
|
21
|
-
|
22
|
-
if property.is_a?(V8::Function)
|
23
|
-
return property.call_on(self, *args, &block)
|
24
|
-
else
|
25
|
-
return property
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
include Comparable
|
33
|
-
include Enumerable
|
34
|
-
include Delegated
|
35
|
-
|
36
|
-
def to_hash
|
37
|
-
Hash[*keys.map {|key| [key.to_s, get(key)] }.flatten(1)]
|
38
|
-
end
|
39
|
-
|
40
|
-
def <=>(other)
|
41
|
-
to_hash <=> other
|
42
|
-
end
|
43
|
-
|
44
|
-
def each(*args, &block)
|
45
|
-
to_hash.each(*args, &block)
|
46
|
-
end
|
47
|
-
|
48
|
-
def delegate
|
49
|
-
to_hash
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def reflect_from(obj)
|
55
|
-
if !obj.nil? and !obj.v8? and !obj.is_a?(Hash)
|
56
|
-
obj.class.declared_methods.each { |meth|
|
57
|
-
if func_name = meth.to_sym.to_js_func_name
|
58
|
-
func = set(func_name, obj.method(meth))
|
59
|
-
func.bind(obj)
|
60
|
-
end
|
61
|
-
}
|
62
|
-
end
|
63
|
-
self
|
64
|
-
end
|
65
|
-
end # Object
|
66
|
-
end # V8
|