Module: Ckeditor::Orm::Base::AssetBase::InstanceMethods
- Defined in:
- lib/ckeditor/orm/base.rb
Instance Method Summary collapse
- #as_json(options = nil) ⇒ Object
- #as_json_methods ⇒ Object
- #filename ⇒ Object
- #format_created_at ⇒ Object
- #has_dimensions? ⇒ Boolean
- #image? ⇒ Boolean
- #url_content ⇒ Object
- #url_thumb ⇒ Object
Instance Method Details
#as_json(options = nil) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/ckeditor/orm/base.rb', line 34 def as_json( = nil) = { :methods => as_json_methods, :root => "asset" }.merge( || {}) super end |
#as_json_methods ⇒ Object
30 31 32 |
# File 'lib/ckeditor/orm/base.rb', line 30 def as_json_methods [:url_content, :url_thumb, :size, :filename, :format_created_at] end |
#filename ⇒ Object
6 7 8 |
# File 'lib/ckeditor/orm/base.rb', line 6 def filename data_file_name end |
#format_created_at ⇒ Object
18 19 20 |
# File 'lib/ckeditor/orm/base.rb', line 18 def format_created_at self.created_at.strftime("%d.%m.%Y") end |
#has_dimensions? ⇒ Boolean
10 11 12 |
# File 'lib/ckeditor/orm/base.rb', line 10 def has_dimensions? respond_to?(:width) && respond_to?(:height) end |
#image? ⇒ Boolean
14 15 16 |
# File 'lib/ckeditor/orm/base.rb', line 14 def image? Ckeditor::IMAGE_TYPES.include?(data_content_type) end |
#url_content ⇒ Object
22 23 24 |
# File 'lib/ckeditor/orm/base.rb', line 22 def url_content url end |
#url_thumb ⇒ Object
26 27 28 |
# File 'lib/ckeditor/orm/base.rb', line 26 def url_thumb url(:thumb) end |