Module: RedactorRails::Orm::Base::AssetBase::InstanceMethods

Defined in:
lib/redactor-rails/orm/base.rb

Instance Method Summary collapse

Instance Method Details

#as_json(options = nil) ⇒ Object


26
27
28
29
30
31
32
33
# File 'lib/redactor-rails/orm/base.rb', line 26

def as_json(options = nil)
  options = {
    :methods => as_json_methods,
    :root => false
  }

  super options
end

#as_json_methodsObject


22
23
24
# File 'lib/redactor-rails/orm/base.rb', line 22

def as_json_methods
  [:image, :thumb]
end

#has_dimensions?Boolean

Returns:

  • (Boolean)

6
7
8
# File 'lib/redactor-rails/orm/base.rb', line 6

def has_dimensions?
  respond_to?(:width) && respond_to?(:height)
end

#imageObject


14
15
16
# File 'lib/redactor-rails/orm/base.rb', line 14

def image
  url
end

#image?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/redactor-rails/orm/base.rb', line 10

def image?
  RedactorRails::IMAGE_TYPES.include?(data_content_type)
end

#thumbObject


18
19
20
# File 'lib/redactor-rails/orm/base.rb', line 18

def thumb
  url(:thumb)
end