jrubyfx 1.0.0-java → 1.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -4
- data/bin/jrubyfx-compile +32 -0
- data/bin/jrubyfx-jarify +1 -1
- data/lib/jrubyfx.rb +9 -0
- data/lib/jrubyfx/application.rb +1 -1
- data/lib/jrubyfx/compiler_app.rb +49 -0
- data/lib/jrubyfx/controller.rb +50 -8
- data/lib/jrubyfx/core_ext/exts.yml +4 -0
- data/lib/jrubyfx/core_ext/file_chooser.rb +5 -5
- data/lib/jrubyfx/core_ext/geometry.rb +27 -0
- data/lib/jrubyfx/core_ext/grid_pane.rb +30 -0
- data/lib/jrubyfx/core_ext/observable_value.rb +58 -3
- data/lib/jrubyfx/core_ext/path.rb +1 -1
- data/lib/jrubyfx/core_ext/precompiled.rb +1475 -206
- data/lib/jrubyfx/dsl.rb +57 -8
- data/lib/jrubyfx/dsl_map.rb +241 -236
- data/lib/jrubyfx/imports.rb +249 -2
- data/lib/jrubyfx/java_fx_impl.rb +38 -33
- data/lib/jrubyfx/module.rb +11 -8
- data/lib/jrubyfx/part_imports.rb +15 -3
- data/lib/jrubyfx/utils/common_converters.rb +5 -5
- data/lib/jrubyfx/version.rb +1 -1
- data/lib/jrubyfx_tasks.rb +27 -8
- metadata +36 -25
data/README.md
CHANGED
@@ -101,6 +101,10 @@ Issues
|
|
101
101
|
* Jarify command needs the `jar` executable in your path.
|
102
102
|
* Any other difficulties are bugs. Please report them
|
103
103
|
|
104
|
+
Contact
|
105
|
+
-------
|
106
|
+
Find us in #jruby on freenode.
|
107
|
+
|
104
108
|
License
|
105
109
|
-------
|
106
110
|
Main code is Apache 2.0. See LICENSE.
|
@@ -108,8 +112,10 @@ Some samples in contrib may have other licenses.
|
|
108
112
|
|
109
113
|
Authors
|
110
114
|
-------
|
111
|
-
- Patrick Plenefisch
|
112
|
-
- Thomas E Enebo
|
113
|
-
-
|
114
|
-
-
|
115
|
+
- Patrick Plenefisch (byteit101)
|
116
|
+
- Thomas E Enebo (enebo)
|
117
|
+
- Hiro Asari (BanzaiMan or asarih)
|
118
|
+
- Jeremy Ebler (whitehat101)
|
119
|
+
- Hiroshi Nakamura (nahi)
|
120
|
+
- Eric West (e_dub or edubkendo)
|
115
121
|
|
data/bin/jrubyfx-compile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
=begin
|
3
|
+
JRubyFX - Write JavaFX and FXML in Ruby
|
4
|
+
Copyright (C) 2013 The JRubyFX Team
|
5
|
+
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
you may not use this file except in compliance with the License.
|
8
|
+
You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
=end
|
18
|
+
|
19
|
+
def usage
|
20
|
+
puts "#{$0} fxml-file [fxml-file ...] [-- require [require ...]]"
|
21
|
+
puts <<THEOPTIONS
|
22
|
+
|
23
|
+
THEOPTIONS
|
24
|
+
exit -1
|
25
|
+
end
|
26
|
+
|
27
|
+
if ARGV.length < 1
|
28
|
+
usage
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'jrubyfx_tasks'
|
32
|
+
JRubyFX::Tasks.compile(ARGV)
|
data/bin/jrubyfx-jarify
CHANGED
@@ -108,7 +108,7 @@ if main.length > 1
|
|
108
108
|
end
|
109
109
|
|
110
110
|
# Jarify!
|
111
|
-
JRubyFX::Tasks::jarify_jrubyfx(project_folder + "
|
111
|
+
JRubyFX::Tasks::jarify_jrubyfx(project_folder + "/*", main_script, nil, output_jar, :file_filter => ->(filename){!filename.end_with?(".jar") or include_jars})
|
112
112
|
|
113
113
|
if native_bundle
|
114
114
|
JRubyFX::Tasks::native_bundles(Dir.pwd, output_jar, verbose, app_name[0])
|
data/lib/jrubyfx.rb
CHANGED
@@ -14,6 +14,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
See the License for the specific language governing permissions and
|
15
15
|
limitations under the License.
|
16
16
|
=end
|
17
|
+
|
18
|
+
if RUBY_VERSION.include? "1.8" or !JRUBY_VERSION
|
19
|
+
puts "JRubyFX requires JRuby to be in 1.9 mode"
|
20
|
+
exit -2
|
21
|
+
end
|
22
|
+
if Gem::Version.new(JRUBY_VERSION) < Gem::Version.new("1.7.4")
|
23
|
+
puts "Warning: JRuby 1.7.3 and prior have bugs that can cause strange errors. Do not submit any bug reports. Please use JRuby 1.7.4 or later."
|
24
|
+
end
|
25
|
+
|
17
26
|
require 'java' # for java_import
|
18
27
|
require 'jruby/core_ext' # for the become_java!
|
19
28
|
|
data/lib/jrubyfx/application.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
=begin
|
2
|
+
JRubyFX - Write JavaFX and FXML in Ruby
|
3
|
+
Copyright (C) 2013 The JRubyFX Team
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
=end
|
17
|
+
require 'jrubyfx'
|
18
|
+
|
19
|
+
# This class is used by the rake task to compile fxml files
|
20
|
+
class CompilerApp < JRubyFX::Application
|
21
|
+
def start(stage)
|
22
|
+
begin
|
23
|
+
args = parameters.raw.to_a
|
24
|
+
if args.include? "--"
|
25
|
+
ar, requires = split(args, "--")
|
26
|
+
requires.each {|x| require x}
|
27
|
+
ar
|
28
|
+
else
|
29
|
+
args
|
30
|
+
end.each do |arg|
|
31
|
+
loader = FxmlLoader.new
|
32
|
+
loader.location = URL.new "file:#{arg}"
|
33
|
+
loader.controller = Object.new
|
34
|
+
puts "Compiling #{arg}..."
|
35
|
+
loader.load(jruby_ext: {jit: 0, dont_load: true, jit_opts: {force: true}})
|
36
|
+
end
|
37
|
+
puts "done"
|
38
|
+
ensure
|
39
|
+
Platform.exit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def split(arr, delim)
|
44
|
+
index = arr.index(delim)
|
45
|
+
first = arr[0...index]
|
46
|
+
second = arr[(index+1)..-1]
|
47
|
+
return first, second
|
48
|
+
end
|
49
|
+
end
|
data/lib/jrubyfx/controller.rb
CHANGED
@@ -19,18 +19,35 @@ require 'jrubyfx-fxmlloader'
|
|
19
19
|
|
20
20
|
# Special methods for fxml loading
|
21
21
|
module Kernel
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
@@jrubyfx_res_dir = {}
|
23
|
+
def fxml_root(value=nil, jar_value=nil)
|
24
|
+
if value or jar_value
|
25
|
+
@@jrubyfx_fxml_dir = JRubyFX::Application.in_jar? ? jar_value : File.expand_path(value)
|
25
26
|
else
|
26
27
|
@@jrubyfx_fxml_dir
|
27
28
|
end
|
28
29
|
end
|
30
|
+
def resource_root(res_name, value=nil, jar_value=nil)
|
31
|
+
if value or jar_value
|
32
|
+
@@jrubyfx_res_dir[res_name.to_sym] = JRubyFX::Application.in_jar? ? jar_value : File.expand_path(value)
|
33
|
+
else
|
34
|
+
@@jrubyfx_res_dir[res_name.to_sym]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
def resource_url(type, relative_path)
|
38
|
+
if JRubyFX::Application.in_jar?
|
39
|
+
JRuby.runtime.jruby_class_loader.get_resource("#{resource_root(type)}/#{relative_path}");
|
40
|
+
else
|
41
|
+
java.net.URL.new("file:" + File.join(resource_root(type), relative_path))
|
42
|
+
end
|
43
|
+
end
|
29
44
|
end
|
30
45
|
|
31
46
|
# Inherit from this class for FXML controllers
|
32
47
|
module JRubyFX::Controller
|
33
48
|
include JRubyFX::DSL
|
49
|
+
include JRubyFX::FXImports
|
50
|
+
|
34
51
|
java_import 'java.net.URL'
|
35
52
|
|
36
53
|
DEFAULT_SETTINGS = {
|
@@ -48,10 +65,11 @@ module JRubyFX::Controller
|
|
48
65
|
def self.included(base)
|
49
66
|
base.extend(ClassMethods)
|
50
67
|
base.extend(JRubyFX::FXMLClassUtils)
|
68
|
+
base.extend(JRubyFX::FXImports)
|
51
69
|
# register ourselves as a control. overridable with custom_fxml_control
|
52
70
|
register_type base if base.is_a? Class
|
53
71
|
end
|
54
|
-
|
72
|
+
|
55
73
|
# class methods for FXML controllers
|
56
74
|
module ClassMethods
|
57
75
|
include JRubyFX::DSL
|
@@ -115,6 +133,9 @@ module JRubyFX::Controller
|
|
115
133
|
# This is the default override for custom controls
|
116
134
|
# Normal FXML controllers will use Control#new
|
117
135
|
def new(*args, &block)
|
136
|
+
if @preparsed && @preparsed.length > 0
|
137
|
+
return @preparsed.pop.finish_initialization(*args, &block)
|
138
|
+
end
|
118
139
|
# Custom controls don't always need to be pure java, but oh well...
|
119
140
|
become_java! if @filename
|
120
141
|
|
@@ -129,6 +150,17 @@ module JRubyFX::Controller
|
|
129
150
|
ctrl
|
130
151
|
end
|
131
152
|
|
153
|
+
def preparse_new(num=3)
|
154
|
+
become_java! if @filename
|
155
|
+
@preparsed ||= []
|
156
|
+
num.times do
|
157
|
+
ctrl = allocate
|
158
|
+
ctrl.pre_initialize_controller(DEFAULT_SETTINGS.merge({root_dir: @fxml_root_dir || fxml_root,
|
159
|
+
filename: @filename})) if @filename
|
160
|
+
@preparsed << ctrl
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
132
164
|
#decorator to force becoming java class
|
133
165
|
def become_java
|
134
166
|
@force_java = true
|
@@ -206,8 +238,18 @@ module JRubyFX::Controller
|
|
206
238
|
finish_initialization *args, &block
|
207
239
|
end
|
208
240
|
|
241
|
+
# Initialize all controllers
|
242
|
+
def pre_initialize_controller(options={})
|
243
|
+
|
244
|
+
# JRuby complains loudly (probably broken behavior) if we don't call the ctor
|
245
|
+
java_ctor self.class.superclass.instance_method(:initialize).bind(self), [] #TODO: do we need to call this now with []?
|
246
|
+
|
247
|
+
# load the FXML file with the current control as the root
|
248
|
+
load_fxml options[:filename], options[:root_dir]
|
249
|
+
end
|
250
|
+
|
209
251
|
def load_fxml(filename, root_dir=nil)
|
210
|
-
fx = Controller.get_fxml_loader(filename, self, root_dir)
|
252
|
+
fx = Controller.get_fxml_loader(filename, self, root_dir || @fxml_root_dir || fxml_root)
|
211
253
|
fx.root = self
|
212
254
|
fx.load
|
213
255
|
end
|
@@ -247,7 +289,7 @@ module JRubyFX::Controller
|
|
247
289
|
def css(css_selector)
|
248
290
|
@scene.get_root.lookup_all(css_selector).to_a
|
249
291
|
end
|
250
|
-
|
292
|
+
|
251
293
|
# Loads a controller-less file
|
252
294
|
def self.load_fxml_only(filename, stage, settings={})
|
253
295
|
# Inherit from default settings
|
@@ -256,7 +298,7 @@ module JRubyFX::Controller
|
|
256
298
|
|
257
299
|
# load the FXML file
|
258
300
|
root = Controller.get_fxml_loader(settings[:filename], nil, settings[:root_dir]).load
|
259
|
-
|
301
|
+
|
260
302
|
# TODO: de-duplicate this code
|
261
303
|
|
262
304
|
# Unless the FXML root node is a scene, wrap that node in a scene
|
@@ -294,7 +336,7 @@ module JRubyFX::Controller
|
|
294
336
|
if JRubyFX::Application.in_jar?
|
295
337
|
# If we are in a jar file, use the class loader to get the file from the jar (like java)
|
296
338
|
# TODO: should just be able to use URLs
|
297
|
-
JRuby.runtime.jruby_class_loader.get_resource filename
|
339
|
+
JRuby.runtime.jruby_class_loader.get_resource File.join(root_dir, filename)
|
298
340
|
else
|
299
341
|
root_dir ||= fxml_root
|
300
342
|
# If we are in the normal filesystem, create a file url path relative to relative_to or this file
|
@@ -31,6 +31,9 @@
|
|
31
31
|
"Java::JavafxSceneControl::ContextMenu":
|
32
32
|
method_missing: "Java::JavafxSceneControl::MenuItem"
|
33
33
|
add: get_items
|
34
|
+
"Java::JavafxSceneControl::MenuButton":
|
35
|
+
method_missing: "Java::JavafxSceneControl::MenuItem"
|
36
|
+
add: get_items
|
34
37
|
"Java::JavafxSceneControl::MenuItem":
|
35
38
|
dsl: Need to insert manually
|
36
39
|
"Java::JavafxAnimation::Timeline":
|
@@ -44,6 +47,7 @@
|
|
44
47
|
"Java::JavafxSceneControl::ScrollPane":
|
45
48
|
logical_child: content
|
46
49
|
"Java::JavafxSceneControl::Accordion":
|
50
|
+
add: panes
|
47
51
|
logical_children: panes
|
48
52
|
"Java::JavafxSceneShape::Circle":
|
49
53
|
new_converter: [[], [none], [none, color], [none, none, none], [none, none, none, color]]
|
@@ -24,9 +24,9 @@ class Java::javafx::stage::FileChooser
|
|
24
24
|
# add_extension_filter(description)
|
25
25
|
# add_extension_filter(description, filter)
|
26
26
|
# add_extension_filter(description, [filter, ...])
|
27
|
-
#
|
27
|
+
#
|
28
28
|
# Takes ether a straight descriptions with embedded (*.whatnot) filter, or
|
29
|
-
# separately, where filter can be an array or a string. Note that without a
|
29
|
+
# separately, where filter can be an array or a string. Note that without a
|
30
30
|
# filter, the description MUST contain a list of extensions in parens.
|
31
31
|
# === Examples
|
32
32
|
# add_extension_filter("Ruby Files (*.rb)")
|
@@ -42,17 +42,17 @@ class Java::javafx::stage::FileChooser
|
|
42
42
|
filter = [filter] unless filter.is_a? Array
|
43
43
|
extension_filters.add(ExtensionFilter.new(desc.to_s, filter))
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
# call-seq:
|
47
47
|
# add_extension_filters([description, ...])
|
48
48
|
# add_extension_filters({description => filter, ...})
|
49
49
|
# add_extension_filters({description => [filter, ...], ...})
|
50
|
-
#
|
50
|
+
#
|
51
51
|
# Takes a straight list of descriptions with embedded (*.whatnot) filters, or
|
52
52
|
# a hash of "description" => "*.whatnot" or a hash of "description => ["*.whatnot", "*.etc"]
|
53
53
|
# === Examples
|
54
54
|
# add_extension_filters(["Ruby Files (*.rb)", "Python Files (*.py)"])
|
55
|
-
# add_extension_filters(
|
55
|
+
# add_extension_filters("Ruby Files (*.rb)" => "*.rb", "Python Files (*.py)" => ["*.py", "*.pyc"])
|
56
56
|
#
|
57
57
|
def add_extension_filters(filters)
|
58
58
|
#works with both arrays and hashes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
=begin
|
2
|
+
JRubyFX - Write JavaFX and FXML in Ruby
|
3
|
+
Copyright (C) 2013 The JRubyFX Team
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
=end
|
17
|
+
require 'jrubyfx/dsl'
|
18
|
+
|
19
|
+
# JRubyFX DSL extensions for JavaFX Paths
|
20
|
+
class Java::javafx::geometry::Point2D
|
21
|
+
def to_a
|
22
|
+
[x,y]
|
23
|
+
end
|
24
|
+
def to_ary
|
25
|
+
[x,y]
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
=begin
|
2
|
+
JRubyFX - Write JavaFX and FXML in Ruby
|
3
|
+
Copyright (C) 2013 The JRubyFX Team
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
=end
|
17
|
+
require 'jrubyfx/dsl'
|
18
|
+
|
19
|
+
# JRubyFX DSL extensions for JavaFX Grid panes
|
20
|
+
class Java::javafx::scene::layout::GridPane
|
21
|
+
include JRubyFX::DSL
|
22
|
+
# don't kill the add(node, int, int..) methods
|
23
|
+
def add(node, *moar)
|
24
|
+
if moar.length > 1
|
25
|
+
self.java_send :add, [Node, *([Java::int]*moar.length)], node, *moar
|
26
|
+
else
|
27
|
+
children << node
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -19,10 +19,12 @@ require 'jrubyfx'
|
|
19
19
|
# JRubyFX DSL extensions for JavaFX ObservableValues
|
20
20
|
module Java::javafx::beans::value::ObservableValue
|
21
21
|
java_import Java::javafx.beans.value.ChangeListener
|
22
|
+
java_import Java::javafx.beans.InvalidationListener
|
22
23
|
|
23
24
|
##
|
24
25
|
# call-seq:
|
25
26
|
# add_change_listener { |observable, old_value, new_value| block }
|
27
|
+
# add_change_listener { |new_value| block }
|
26
28
|
#
|
27
29
|
# Add a ruby block to call when the property changes changes
|
28
30
|
def add_change_listener(type=nil, &block)
|
@@ -33,10 +35,40 @@ module Java::javafx::beans::value::ObservableValue
|
|
33
35
|
if type == :list || type == :map
|
34
36
|
super(&block)
|
35
37
|
else
|
36
|
-
|
38
|
+
old_verbose = $VERBOSE
|
39
|
+
begin
|
40
|
+
$VERBOSE = nil
|
41
|
+
addListener(ChangeListener.impl {|name, x, y, z|
|
42
|
+
if block.arity == 1
|
43
|
+
block.call(z) # just call with new
|
44
|
+
else
|
45
|
+
block.call(x, y, z)
|
46
|
+
end
|
47
|
+
})
|
48
|
+
ensure
|
49
|
+
# always re-set to old value, even if block raises an exception
|
50
|
+
$VERBOSE = old_verbose
|
51
|
+
end
|
37
52
|
end
|
38
53
|
end
|
39
54
|
|
55
|
+
|
56
|
+
##
|
57
|
+
# call-seq:
|
58
|
+
# add_invalidation_listener { |observable| block }
|
59
|
+
#
|
60
|
+
# Add a ruby block to call when the property invalidates itself (bad property!)
|
61
|
+
def add_invalidation_listener(&block)
|
62
|
+
old_verbose = $VERBOSE
|
63
|
+
begin
|
64
|
+
$VERBOSE = nil
|
65
|
+
addListener(InvalidationListener.impl {|name, change| block.call(change) })
|
66
|
+
ensure
|
67
|
+
# always re-set to old value, even if block raises an exception
|
68
|
+
$VERBOSE = old_verbose
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
40
72
|
# FIXME: Not sure how to remove with this API. We are passing in a proc
|
41
73
|
# and we would need to examine each proc to determine which listener to
|
42
74
|
# remove. Probably a way to do it in each derived real class which actually
|
@@ -53,7 +85,18 @@ module Java::javafx::collections::ObservableList
|
|
53
85
|
#
|
54
86
|
# Add a ruby block to call when the property changes changes
|
55
87
|
def add_change_listener(&block)
|
56
|
-
|
88
|
+
old_verbose = $VERBOSE
|
89
|
+
begin
|
90
|
+
$VERBOSE = nil
|
91
|
+
addListener(ListChangeListener.impl {|name, x|block.call(x)})
|
92
|
+
ensure
|
93
|
+
# always re-set to old value, even if block raises an exception
|
94
|
+
$VERBOSE = old_verbose
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def index(x)
|
99
|
+
indexOf(x)
|
57
100
|
end
|
58
101
|
|
59
102
|
# FIXME: Not sure how to remove with this API. We are passing in a proc
|
@@ -72,7 +115,14 @@ module Java::javafx::collections::ObservableMap
|
|
72
115
|
#
|
73
116
|
# Add a ruby block to call when the property changes changes
|
74
117
|
def add_change_listener(&block)
|
75
|
-
|
118
|
+
old_verbose = $VERBOSE
|
119
|
+
begin
|
120
|
+
$VERBOSE = nil
|
121
|
+
addListener(MapChangeListener.impl {|name, x|block.call(x)})
|
122
|
+
ensure
|
123
|
+
# always re-set to old value, even if block raises an exception
|
124
|
+
$VERBOSE = old_verbose
|
125
|
+
end
|
76
126
|
end
|
77
127
|
|
78
128
|
# FIXME: Not sure how to remove with this API. We are passing in a proc
|
@@ -99,5 +149,10 @@ class Class
|
|
99
149
|
def property_accessor(*symbol_names)
|
100
150
|
property_reader *symbol_names
|
101
151
|
property_writer *symbol_names
|
152
|
+
symbol_names.each do |symbol_name|
|
153
|
+
send(:define_method, symbol_name.id2name + "_property") do
|
154
|
+
instance_variable_get("@#{symbol_name}")
|
155
|
+
end
|
156
|
+
end
|
102
157
|
end
|
103
158
|
end
|