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
- #size ⇒ Object
- #url_content ⇒ Object
- #url_thumb ⇒ Object
Instance Method Details
#as_json(options = nil) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/ckeditor/orm/base.rb', line 38 def as_json( = nil) = { :methods => as_json_methods, :root => "asset" }.merge( || {}) super end |
#as_json_methods ⇒ Object
34 35 36 |
# File 'lib/ckeditor/orm/base.rb', line 34 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
22 23 24 |
# File 'lib/ckeditor/orm/base.rb', line 22 def format_created_at self.created_at.strftime("%d.%m.%Y") end |
#has_dimensions? ⇒ Boolean
14 15 16 |
# File 'lib/ckeditor/orm/base.rb', line 14 def has_dimensions? respond_to?(:width) && respond_to?(:height) end |
#image? ⇒ Boolean
18 19 20 |
# File 'lib/ckeditor/orm/base.rb', line 18 def image? Ckeditor::IMAGE_TYPES.include?(data_content_type) end |
#size ⇒ Object
10 11 12 |
# File 'lib/ckeditor/orm/base.rb', line 10 def size data_file_size end |
#url_content ⇒ Object
26 27 28 |
# File 'lib/ckeditor/orm/base.rb', line 26 def url_content url end |
#url_thumb ⇒ Object
30 31 32 |
# File 'lib/ckeditor/orm/base.rb', line 30 def url_thumb url(:thumb) end |