Module: Yoda::Store::Objects::ConnectedDelegation

Included in:
Base::Connected, LibrariesStatus::Connected, Library::Core::Connected, Library::Gem::Connected, Library::Std::Connected
Defined in:
lib/yoda/store/objects/connected_delegation.rb

Instance Method Summary collapse

Instance Method Details

#delegate_to_object(*method_names) ⇒ void

This method returns an undefined value.

Parameters:

  • method_names (Array<Symbol>)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/yoda/store/objects/connected_delegation.rb', line 7

def delegate_to_object(*method_names)
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0')
    method_names.each do |method_name|
      define_method(method_name) do |*args, **kwargs|
        object.public_send(method_name, *args, **kwargs)
      end
    end
  else
    method_names.each do |method_name|
      define_method(method_name) do |*args|
        object.public_send(method_name, *args)
      end
    end
  end
end