Sha256: 74ef0e8066e79a41e09fbad1e8a928b9a1dd60601f2d104f30be74f932de0aa4
Contents?: true
Size: 707 Bytes
Versions: 23
Compression:
Stored size: 707 Bytes
Contents
class Shoes class Widget def self.inherited klass, &blk m = klass.to_s[/(^|::)(\w+)$/, 2]. gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase Shoes::App.class_eval do define_method m do |*args, &blk| klass.class_variable_set :@@__app__, self parent = app.cslot klass.new(*args, &blk).tap do |s| s.define_singleton_method(:parent){parent} end end end klass.class_eval do define_method :method_missing do |*args, &blk| klass.class_variable_get(:@@__app__).send *args, &blk end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems