module Shrine::Attachment::InstanceMethods
Public Class Methods
new(name, **options)
click to toggle source
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.
# File lib/shrine/attachment.rb, line 34 def initialize(name, **options) @name = name.to_sym @options = options end
Public Instance Methods
attachment_name()
click to toggle source
Returns name of the attachment this module provides.
# File lib/shrine/attachment.rb, line 40 def attachment_name @name end
inspect()
click to toggle source
Returns class name with attachment name included.
Shrine::Attachment.new(:image).to_s #=> "#<Shrine::Attachment(image)>"
# File lib/shrine/attachment.rb, line 52 def inspect "#<#{self.class.inspect}(#{@name})>" end
Also aliased as: to_s
options()
click to toggle source
Returns options that are to be passed to the Attacher
.
# File lib/shrine/attachment.rb, line 45 def options @options end
shrine_class()
click to toggle source
Returns the Shrine
class that this attachmentâs class is namespaced under.
# File lib/shrine/attachment.rb, line 59 def shrine_class self.class.shrine_class end