Class: Fiona7::BinaryHandling::MetaBinary::UnmodifiedBinary

Inherits:
ActualBinary
  • Object
show all
Defined in:
lib/fiona7/scrivito_patches/binary.rb

Direct Known Subclasses

TransformedBinary

Instance Method Summary collapse

Methods inherited from ActualBinary

#initialize

Constructor Details

This class inherits a constructor from Fiona7::BinaryHandling::MetaBinary::ActualBinary

Instance Method Details

#filenameObject



64
65
66
# File 'lib/fiona7/scrivito_patches/binary.rb', line 64

def filename
  self.obj.filename
end

#filepathObject



68
69
70
# File 'lib/fiona7/scrivito_patches/binary.rb', line 68

def filepath
  self.obj.body_data_path
end

#heightObject



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/fiona7/scrivito_patches/binary.rb', line 92

def height
  self.cache("#{self.last_changed}-height") do
    if self.image
      self.image[:height]
    else
      0
    end
  end
rescue 
  0
end

#image?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/fiona7/scrivito_patches/binary.rb', line 76

def image?
  self.obj.image?
end

#last_changedObject



108
109
110
# File 'lib/fiona7/scrivito_patches/binary.rb', line 108

def last_changed
  self.obj.last_changed.utc
end

#lengthObject



72
73
74
# File 'lib/fiona7/scrivito_patches/binary.rb', line 72

def length
  self.obj.body_length
end

#mime_typeObject



104
105
106
# File 'lib/fiona7/scrivito_patches/binary.rb', line 104

def mime_type
  self.obj.mime_type
end

#present?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/fiona7/scrivito_patches/binary.rb', line 60

def present?
  !self.obj.nil?
end

#valid?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/fiona7/scrivito_patches/binary.rb', line 56

def valid?
  self.binary_id >= 0 && self.obj.try(:binary?)
end

#widthObject



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/fiona7/scrivito_patches/binary.rb', line 80

def width
  self.cache("#{self.last_changed}-width") do
    if self.image
      self.image[:width]
    else
      0
    end
  end
rescue 
  0
end