Module: Shrine::Plugins::Entity::AttachmentMethods

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

Instance Method Summary collapse

Instance Method Details

#included(klass) ⇒ Object

Defines class methods on inclusion.


20
21
22
23
24
25
26
27
28
# File 'lib/shrine/plugins/entity.rb', line 20

def included(klass)
  super

  attachment = self

  klass.send(:define_singleton_method, :"#{@name}_attacher") do |**options|
    attachment.send(:class_attacher, **options)
  end
end

#initialize(name, **options) ⇒ Object

Defines instance methods on initialization.


13
14
15
16
17
# File 'lib/shrine/plugins/entity.rb', line 13

def initialize(name, **options)
  super

  define_entity_methods(name)
end