Module: Sevgi::Graphics::Mixtures::Call::InstanceMethods
- Defined in:
- lib/sevgi/graphics/mixtures/call.rb
Instance Method Summary collapse
Instance Method Details
#Call(mod) ⇒ Object
8 9 10 |
# File 'lib/sevgi/graphics/mixtures/call.rb', line 8 def Call(mod, ...) CallMethods(mod, nil, ...) end |
#CallMethods(mod, methods) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sevgi/graphics/mixtures/call.rb', line 12 def CallMethods(mod, methods, ...) raise(ArgumentError, "Must be a module: #{mod}") unless mod.instance_of?(::Module) all = mod.instance_methods.sort if methods diff = ((given = Array(methods)) - all) raise(ArgumentError, "No such methods in #{mod}: #{diff.join(", ")}") unless diff.empty? else given = all end tap { given.each { mod.instance_method(_1).bind(self).call(...) } } end |