This file contains hidden or 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
| require 'live_ast' | |
| require 'live_ast/to_ruby' | |
| module Player | |
| alias metho_missing_org method_missing | |
| def method_missing (name, *args) | |
| current = Context.current | |
| raise "no current context" unless current | |
| role_name = current.role_name | |
| method_name = "self_#{role_name}_#{name}".to_sym |
This file contains hidden or 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
| class Context | |
| def bind(player, roleMethods) | |
| lambda {|(*args)| | |
| if args.length == 0 then return player end | |
| name = args[0] | |
| m = roleMethods[name] | |
| if m == nil | |
| m = player.method(name) | |
| end | |
| m.call *args[1..-1] |
This file contains hidden or 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
| require 'alias_dci' | |
| class A | |
| include AliasDCI::DataObject | |
| def foo | |
| "a" | |
| end | |
| end | |
| class C | |
| include AliasDCI::Context, AliasDCI::DataObject |