Class: Alchemy::StorageAdapter

Inherits:
Object
  • Object
show all
Defined in:
app/models/alchemy/storage_adapter.rb,
app/models/alchemy/storage_adapter/dragonfly.rb,
app/models/alchemy/storage_adapter/active_storage.rb,
app/models/alchemy/storage_adapter/dragonfly/picture_url.rb,
app/models/alchemy/storage_adapter/dragonfly/preprocessor.rb,
app/models/alchemy/storage_adapter/dragonfly/attachment_url.rb,
app/models/alchemy/storage_adapter/active_storage/picture_url.rb,
app/models/alchemy/storage_adapter/active_storage/preprocessor.rb,
app/jobs/alchemy/storage_adapter/active_storage/sanitize_svg_job.rb,
app/models/alchemy/storage_adapter/active_storage/attachment_url.rb

Defined Under Namespace

Modules: ActiveStorage, Dragonfly Classes: UnknownAdapterError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ StorageAdapter

Returns a new instance of StorageAdapter.



42
43
44
45
# File 'app/models/alchemy/storage_adapter.rb', line 42

def initialize(name)
  @name = name.to_sym
  @adapter = adapter_class
end

Instance Attribute Details

#adapter ⇒ Object (readonly)

Returns the value of attribute adapter.



5
6
7
# File 'app/models/alchemy/storage_adapter.rb', line 5

def adapter
  @adapter
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



5
6
7
# File 'app/models/alchemy/storage_adapter.rb', line 5

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



47
48
49
# File 'app/models/alchemy/storage_adapter.rb', line 47

def ==(other)
  name == other.to_sym
end

#active_storage? ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/alchemy/storage_adapter.rb', line 51

def active_storage?
  name == :active_storage
end

#attachment_class_methods ⇒ Object



63
64
65
# File 'app/models/alchemy/storage_adapter.rb', line 63

def attachment_class_methods
  adapter::AttachmentClassMethods
end

#dragonfly? ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'app/models/alchemy/storage_adapter.rb', line 55

def dragonfly?
  name == :dragonfly
end

#picture_class_methods ⇒ Object



59
60
61
# File 'app/models/alchemy/storage_adapter.rb', line 59

def picture_class_methods
  adapter::PictureClassMethods
end