Module: Shrine::Plugins::Derivatives::AttachmentMethods

Defined in:
lib/shrine/plugins/derivatives.rb

Instance Method Summary collapse

Instance Method Details

#define_entity_methods(name) ⇒ Object


30
31
32
33
34
35
36
# File 'lib/shrine/plugins/derivatives.rb', line 30

def define_entity_methods(name)
  super if defined?(super)

  define_method(:"#{name}_derivatives") do |*args|
    send(:"#{name}_attacher").get_derivatives(*args)
  end
end

#define_model_methods(name) ⇒ Object


38
39
40
41
42
43
44
# File 'lib/shrine/plugins/derivatives.rb', line 38

def define_model_methods(name)
  super if defined?(super)

  define_method(:"#{name}_derivatives!") do |*args, **options|
    send(:"#{name}_attacher").create_derivatives(*args, **options)
  end
end