Class: Ckeditor::Picture

Inherits:
Asset
  • Object
show all
Defined in:
lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb,
lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb,
lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb,
lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb,
lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb,
lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb,
lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/picture.rb

Constant Summary

Constants included from Backend::Dragonfly

Backend::Dragonfly::FORMATS

Instance Attribute Summary

Attributes inherited from Asset

#data

Instance Method Summary collapse

Methods included from Backend::ActiveStorage

included

Methods included from Backend::Dragonfly

included

Methods included from Orm::ActiveRecord::AssetBase

included

Methods included from Backend::Paperclip

included

Methods included from Backend::Shrine

included

Methods included from Orm::Mongoid::AssetBase

included

Instance Method Details

#datasourceObject



44
45
46
47
48
49
# File 'lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb', line 44

def datasource
  @datasource ||= HashWithIndifferentAccess
                  .new(data)
                  .fetch(:thumb, OpenStruct.new(metadata: {}))
                  .
end

#pathObject



40
41
42
# File 'lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb', line 40

def path
  data[:thumb].storage.path(data[:thumb].id)
end

#url_contentObject



6
7
8
# File 'lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/picture.rb', line 6

def url_content
  data_url(:content)
end

#url_thumbObject



36
37
38
# File 'lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb', line 36

def url_thumb
  data_url(:thumb)
end