Module: Jtor::StdLib::Base
- Defined in:
- lib/jtor-stdlib/base.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/jtor-stdlib/base.rb', line 4 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#initialize(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jtor-stdlib/base.rb', line 8 def initialize(*args) method, constructor_call = self.class.lookup(:initialize, *args) # I really tried to avoid using eval fellows, but JRuby is very fixed # on `super` being called here first than anything, and it wouldn't # accept a `proc` calling `initialize` on `sup`, so this will have # to do for now. if method eval(constructor_call) instance_exec(*args, &method) else super end self.class._initializers.each do |initializer| instance_exec(*args, &initializer) end end |
#sup ⇒ Object
25 26 27 |
# File 'lib/jtor-stdlib/base.rb', line 25 def sup @_sup ||= SuperObject.new(self) end |