Module: Dry::Mutations::DSL::Weirdo

Defined in:
lib/dry/mutations/dsl/weirdo.rb

Overview

:nodoc:

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &_cb) ⇒ Object

FIXME: try-catch and call super in rescue clause



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dry/mutations/dsl/weirdo.rb', line 6

def method_missing m, *args, &_cb
  puts "==> [MM] “#{m}” called with args: “#{args.inspect}"
  name, current = args.shift, @current
  schema do
    configure do
      define_method(:"#{name}?") do |_value|
        false # FIXME
      end
    end

    __send__(current, name) { __send__ :"#{name}?" }
  end
end