Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit edf2144
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Maglev.persistent do | ||
module Mixin | ||
|
||
module InstanceMethods | ||
def got_instance_methods? | ||
true | ||
end | ||
end | ||
|
||
module ClassMethods | ||
def got_class_methods? | ||
true | ||
end | ||
end | ||
|
||
def self.included(klass) | ||
super | ||
klass.maglev_persistable | ||
Maglev.persistent do | ||
klass.send :include, InstanceMethods | ||
klass.extend ClassMethods | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
raise "please run some_class.rb first" unless Maglev::PERSISTENT_ROOT[:some_instance] | ||
Maglev::PERSISTENT_ROOT[:some_instance].got_instance_methods? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
raise "please run mixin.rb first" unless defined? Mixin | ||
|
||
class SomeClass | ||
include Mixin | ||
end | ||
|
||
SomeClass.got_class_methods? | ||
|
||
Maglev::PERSISTENT_ROOT[:some_instance] = SomeClass.new |