Class: Shrine::Storage::Cloudinary::Delegator

Inherits:
Object
  • Object
show all
Defined in:
lib/shrine/storage/cloudinary.rb

Overview

Delegates each method call to the specified klass, but passing specified default options.

Instance Method Summary collapse

Constructor Details

#initialize(klass, default_options) ⇒ Delegator

Returns a new instance of Delegator.



175
176
177
178
# File 'lib/shrine/storage/cloudinary.rb', line 175

def initialize(klass, default_options)
  @klass           = klass
  @default_options = default_options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



180
181
182
# File 'lib/shrine/storage/cloudinary.rb', line 180

def method_missing(name, *args, **options, &block)
  @klass.public_send(name, *args, **@default_options, **options, &block)
end

Instance Method Details

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

Returns:

  • (Boolean)


184
185
186
# File 'lib/shrine/storage/cloudinary.rb', line 184

def respond_to_missing?(name, include_private = false)
  @klass.respond_to?(name, include_private)
end