Class: Ckeditor::Asset
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ckeditor::Asset
- Defined in:
- lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb,
lib/generators/ckeditor/migration/templates/models/attachment_fu/asset.rb
Direct Known Subclasses
Instance Method Summary collapse
- #content_type ⇒ Object
- #filename ⇒ Object
- #format_created_at ⇒ Object
- #geometry ⇒ Object
- #has_dimensions? ⇒ Boolean
- #image? ⇒ Boolean
- #path ⇒ Object
- #public_filename ⇒ Object
- #size ⇒ Object
- #styles ⇒ Object
- #to_xml(options = {}) ⇒ Object
- #url(*args) ⇒ Object
Instance Method Details
#content_type ⇒ Object
23 24 25 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 23 def content_type data_content_type end |
#filename ⇒ Object
19 20 21 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 19 def filename data_file_name end |
#format_created_at ⇒ Object
39 40 41 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 39 def format_created_at I18n.l(created_at, :format=>"%d.%m.%Y %H:%M") end |
#geometry ⇒ Object
70 71 72 73 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 70 def geometry @geometry ||= Paperclip::Geometry.from_file(data.to_file) @geometry end |
#has_dimensions? ⇒ Boolean
62 63 64 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 62 def has_dimensions? respond_to?(:width) && respond_to?(:height) end |
#image? ⇒ Boolean
66 67 68 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 66 def image? Ckeditor::IMAGE_TYPES.include?(data_content_type) end |
#path ⇒ Object
31 32 33 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 31 def path data.path end |
#public_filename ⇒ Object
17 18 19 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 17 def url(*args) data.url(*args) end |
#size ⇒ Object
27 28 29 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 27 def size data_file_size end |
#styles ⇒ Object
35 36 37 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 35 def styles data.styles end |
#to_xml(options = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 43 def to_xml( = {}) builder = [:builder] ||= Nokogiri::XML::Builder.new() builder.send(self.type.to_s.downcase) do |xml| xml.id_ self.id xml.filename self.filename xml.size self.size xml.path self.url xml.styles do self.styles.each do |style| xml.send(style.first, self.url(style.first)) end end unless self.styles.empty? end builder.to_xml end |
#url(*args) ⇒ Object
14 15 16 |
# File 'lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb', line 14 def url(*args) data.url(*args) end |