Module: Actionizer::ClassMethods

Defined in:
lib/actionizer.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/actionizer.rb', line 13

def method_missing(method_name, *args, &block)
  instance = new(*args)

  if instance.respond_to?(method_name)
    instance.tap(&method_name).output
  else
    super
  end
rescue Actionizer::Failure => af
  af.output
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/actionizer.rb', line 25

def respond_to_missing?(method_name, include_private = false)
  new.respond_to?(method_name, include_private)
end