module Shrine::Attachment::InstanceMethods
Public Class Methods
Source
# File lib/shrine/attachment.rb 34 def initialize(name, **options) 35 @name = name.to_sym 36 @options = options 37 end
Instantiates an attachment module for a given attribute name, which can then be included to a model class. Second argument will be passed to an attacher module.
Public Instance Methods
Source
# File lib/shrine/attachment.rb 40 def attachment_name 41 @name 42 end
Returns name of the attachment this module provides.
Source
# File lib/shrine/attachment.rb 52 def inspect 53 "#<#{self.class.inspect}(#{@name})>" 54 end
Returns class name with attachment name included.
Shrine::Attachment.new(:image).to_s #=> "#<Shrine::Attachment(image)>"
Also aliased as: to_s
Source
# File lib/shrine/attachment.rb 45 def options 46 @options 47 end
Returns options that are to be passed to the Attacher.
Source
# File lib/shrine/attachment.rb 59 def shrine_class 60 self.class.shrine_class 61 end
Returns the Shrine class that this attachment’s class is namespaced under.