Skip to content

Commit

Permalink
* shoes/ruby.c: since shoes 3 (policeman) is switching to ruby 1.9, …
Browse files Browse the repository at this point in the history
…i've moved away from loading scripts into an anonymous binding (which was superficial anyway) and have moved to loading into the toplevel. as part of this work, i've moved all elements into Shoes::Types mixin, which is included in the Shoes class and is mixed into all new apps (to allow the "style(Para, ...)" syntax.

 * lib/shoes.rb: Shoes.anonymous_binding is gone.
  • Loading branch information
_why committed May 12, 2009
1 parent 40c36e8 commit eb59c0e
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 86 deletions.
15 changes: 2 additions & 13 deletions lib/shoes.rb
Expand Up @@ -36,17 +36,6 @@ class Shoes
para "404 NOT FOUND, GUYS!"
end

# Using TOPLEVEL to pacify Ruby 1.9 for now
def self.anonymous_binding
return TOPLEVEL_BINDING if RUBY_VERSION =~ /^1\.9/
obj = Object.new
return \
class << obj
def self.to_s; "(shoes)" end
binding
end
end

@mounts = []

OPTS = OptionParser.new do |opts|
Expand Down Expand Up @@ -388,7 +377,7 @@ def self.visit(path)
$0.replace path

code = File.read(path)
eval(code, Shoes.anonymous_binding, path)
eval(code, TOPLEVEL_BINDING, path)
end
rescue SettingUp
rescue Object => e
Expand Down Expand Up @@ -452,7 +441,7 @@ def tween opts, &blk

{Background => [:angle, :radius, :curve, *BASIC_S],
Border => [:angle, :radius, :curve, :strokewidth, *BASIC_S],
::Canvas => [:scroll, :start, :finish, :keypress, *(MOUSE_S|BASIC_S)],
Canvas => [:scroll, :start, :finish, :keypress, *(MOUSE_S|BASIC_S)],
Check => [:click, :checked, *BASIC_S],
Radio => [:click, :checked, :group, *BASIC_S],
EditLine => [:change, :secret, :text, *BASIC_S],
Expand Down
2 changes: 1 addition & 1 deletion lib/shoes/help.rb
Expand Up @@ -153,7 +153,7 @@ def index_page
end

def run_code str
eval(str, Shoes.anonymous_binding)
eval(str, TOPLEVEL_BINDING)
end

def load_docs path
Expand Down
1 change: 1 addition & 0 deletions shoes/app.c
Expand Up @@ -60,6 +60,7 @@ shoes_app_alloc(VALUE klass)
app->cursor = s_arrow;
app->scratch = cairo_create(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1));
app->self = Data_Wrap_Struct(klass, shoes_app_mark, shoes_app_free, app);
rb_extend_object(app->self, cTypes);
return app->self;
}

Expand Down

0 comments on commit eb59c0e

Please sign in to comment.