Sha256: dc3f452f662050968b5e791186f3d3844387c8f2895b5556f673a39f35871eb3

Contents?: true

Size: 1.02 KB

Versions: 24

Compression:

Stored size: 1.02 KB

Contents

module Ckeditor
  module Orm
    module Base
      module AssetBase
        module InstanceMethods
          def filename
            data_file_name
          end

          def size
            data_file_size
          end
          
          def has_dimensions?
            respond_to?(:width) && respond_to?(:height)
          end
          
          def image?
            Ckeditor::IMAGE_TYPES.include?(data_content_type)
          end

          def format_created_at
            self.created_at.strftime("%d.%m.%Y")
          end

          def url_content
            url
          end

          def url_thumb
            url(:thumb)
          end
          
          def as_json_methods
            [:url_content, :url_thumb, :size, :filename, :format_created_at]
          end

          def as_json(options = nil)
            options = {
              :methods => as_json_methods,
              :root => "asset"
            }.merge(options || {})

            super options
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
ckeditor-4.0.9 lib/ckeditor/orm/base.rb
ckeditor-4.0.8 lib/ckeditor/orm/base.rb
base2_ckeditor-4.0.7 lib/ckeditor/orm/base.rb
ckeditor-4.0.7 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.2.1.4 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.2.1.3 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.2.1.2 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.2.1.1 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.2.1 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1.7 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1.6 lib/ckeditor/orm/base.rb
ckeditor-4.0.6 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1.5 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1.4 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1.3 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1.2 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1.1 lib/ckeditor/orm/base.rb
glebtv-ckeditor-4.1.1 lib/ckeditor/orm/base.rb
ckeditor-4.0.4 lib/ckeditor/orm/base.rb
ckeditor-4.0.2 lib/ckeditor/orm/base.rb