Class: Locomotive::Steam::ContentEntry::FileField

Inherits:
Object
  • Object
show all
Defined in:
lib/locomotive/steam/entities/content_entry.rb

Overview

Represent a file

Instance Method Summary collapse

Instance Method Details

#to_hashObject



238
239
240
# File 'lib/locomotive/steam/entities/content_entry.rb', line 238

def to_hash
  { 'url' => url, 'filename' => filename, 'size' => size, 'updated_at' => updated_at }
end

#to_jsonObject



242
243
244
# File 'lib/locomotive/steam/entities/content_entry.rb', line 242

def to_json
  url
end

#to_liquidObject



246
247
248
# File 'lib/locomotive/steam/entities/content_entry.rb', line 246

def to_liquid
  Locomotive::Steam::Liquid::Drops::UploadedFile.new(self)
end

#urlObject



233
234
235
236
# File 'lib/locomotive/steam/entities/content_entry.rb', line 233

def url
  return if filename.blank?
  base.blank? ? filename : "#{base}/#{filename}"
end