Sequel::Model(:media)
Gets the creation time of this file. If format is provided, the time will be returned as a formatted String. See Time.strftime for details.
# File lib/thoth/model/media.rb, line 47 def created_at(format = nil) if new? format ? Time.now.strftime(format) : Time.now else format ? self[:created_at].strftime(format) : self[:created_at] end end
# File lib/thoth/model/media.rb, line 55 def filename=(filename) self[:filename] = filename.strip unless filename.nil? end
Gets the absolute path to this file.
# File lib/thoth/model/media.rb, line 60 def path Config.media/filename[0].chr.downcase/filename end
# File lib/thoth/model/media.rb, line 64 def size return self[:size] unless self[:size] == 0 && File.exist?(path) self[:size] = File.size(path) save self[:size] end
Gets the time this file was last updated. If format is provided, the time will be returned as a formatted String. See Time.strftime for details.
# File lib/thoth/model/media.rb, line 74 def updated_at(format = nil) if new? format ? Time.now.strftime(format) : Time.now else format ? self[:updated_at].strftime(format) : self[:updated_at] end end
Generated with the Darkfish Rdoc Generator 2.