Sha256: e3efdfec5a6557cabefa24fa113ff23ab74855f1342604dd17069d389d31cef2

Contents?: true

Size: 998 Bytes

Versions: 8

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

require 'orm_adapter/adapters/mongoid'
require 'ckeditor/orm/base'

module Ckeditor
  module Orm
    module Mongoid
      module AssetBase
        def self.included(base)
          base.send(:include, ::Mongoid::Document)
          base.send(:include, ::Mongoid::Timestamps)
          base.send(:include, Base::AssetBase::InstanceMethods)
          base.send(:include, InstanceMethods)
          base.send(:extend, ClassMethods)
        end

        module InstanceMethods
          def type
            _type
          end

          def as_json_methods
            [:id, :type] + super
          end
        end

        module ClassMethods
          def self.extended(base)
            base.class_eval do
              field :data_content_type, type: String
              field :data_file_size, type: Integer
              field :width, type: Integer
              field :height, type: Integer
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ckeditor-5.1.3 lib/ckeditor/orm/mongoid.rb
ckeditor-5.1.2 lib/ckeditor/orm/mongoid.rb
ckeditor-5.1.1 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.14.1 lib/ckeditor/orm/mongoid.rb
ckeditor-5.1.0 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.13.1 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.13.0 lib/ckeditor/orm/mongoid.rb
ckeditor-5.0.0 lib/ckeditor/orm/mongoid.rb