Module: RubyInterface::ClassMethods
- Defined in:
- lib/ruby_interface.rb
Instance Method Summary collapse
Instance Method Details
#defines(*args) ⇒ Object
10 11 12 13 |
# File 'lib/ruby_interface.rb', line 10 def defines(*args) @methods_to_define ||= [] @methods_to_define += args end |
#inherited(klass) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ruby_interface.rb', line 15 def inherited(klass) trace = TracePoint.new(:end) do |point| next unless point.self == klass missing_methods = @methods_to_define - klass.instance_methods(false) trace.disable next if missing_methods.empty? = "Expected #{klass.name} to define " << missing_methods.map { |method| "##{method}" }.join(', ') raise NotImplementedError, end trace.enable end |