Sha256: 220d9c35ca924b550956ed0a65aa4a68d20e193de3cd6ff65c51409a512dd318
Contents?: true
Size: 950 Bytes
Versions: 1
Compression:
Stored size: 950 Bytes
Contents
require 'multidispatch_dsl/generator' require 'multidispatch_dsl/missing_declaration_error' module MultidispatchDSL::DSL def self.included(klass) klass.extend(::MultidispatchDSL::DSL::ClassMethods) end module ClassMethods def mdef(method_name, *declaration, &block) real_method_name = ::MultidispatchDSL::Generator.method_name_from_declaration(method_name, declaration) define_method(real_method_name, &block) unless method_defined?(method_name) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{ method_name }(*args, &block) real_method_name = ::MultidispatchDSL::Generator.method_name_from_args(__callee__, args) if respond_to?(real_method_name) send(real_method_name, *args, &block) else raise ::MultidispatchDSL::MissingDeclarationError.new(__callee__, args) end end RUBY end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multidispatch_dsl-0.1.0 | lib/multidispatch_dsl/dsl.rb |