Module: Flexor::MethodDispatch

Included in:
Plugins::Core::StoreMethods
Defined in:
lib/flexor/method_dispatch.rb

Overview

Handles dynamic getter/setter dispatch via method_missing and caches singleton methods for repeated access.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



12
13
14
15
16
17
18
19
20
# File 'lib/flexor/method_dispatch.rb', line 12

def method_missing(name, *args, &block)
  return super if block

  case [name, args]
  in /^[^=]+=$/, [arg] then write_via_method(name, arg)
  in _, [] then read_via_method(name)
  else super
  end
end

Instance Method Details

#respond_to_missing?(_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/flexor/method_dispatch.rb', line 6

def respond_to_missing?(_name, _include_private = false)
  true
end