Class: Thoth::Media

### Home Classes Methods

### In Files

- lib/thoth/model/media.rb

### Parent

Sequel::Model(:media)

### Methods

- #created_at
- #filename=
- #path
- #size
- #updated_at
- #url

### Included Modules

- Ramaze::Helper::Link

### Files

- robots.txt

### Class/Module Index

Quicksearch

- Thoth
- Thoth::AdminController
- Thoth::ArchiveController
- Thoth::Comment
- Thoth::CommentApiController
- Thoth::CommentController
- Thoth::Config
- Thoth::Error
- Thoth::Importer
- Thoth::MainController
- Thoth::Media
- Thoth::MediaController
- Thoth::MinifyController
- Thoth::Page
- Thoth::PageApiController
- Thoth::PageController
- Thoth::Pager
- Thoth::Plugin
- Thoth::Plugin::Delicious
- Thoth::Plugin::Flickr
- Thoth::Plugin::Tags
- Thoth::Plugin::Twitter
- Thoth::Post
- Thoth::PostApiController
- Thoth::PostController
- Thoth::SchemaError
- Thoth::SearchController
- Thoth::Tag
- Thoth::TagApiController
- Thoth::TagController
- Thoth::TagsPostsMap
- Ramaze
- Ramaze::Dispatcher
- Ramaze::Dispatcher::File
- Ramaze::Helper
- Ramaze::Helper::Admin
- Ramaze::Helper::Cookie
- Ramaze::Helper::Error
- Ramaze::Helper::Pagination
- Ramaze::Helper::Sanitize
- Ramaze::Helper::Wiki
- Ramaze::Helper::Ysearch
- Ramaze::Helper::Ysearch::SearchError
- AddMediaSize
- CreateSchema
- PantsImporter
- PoseidonImporter

No matching classes.

# Thoth::Media

### Public Instance Methods

created_at(format = nil) click to toggle source

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

filename=(filename) click to toggle source

    # File lib/thoth/model/media.rb, line 55
    def filename=(filename)
      self[:filename] = filename.strip unless filename.nil?
    end

path() click to toggle source

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

size() click to toggle source

    # 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

updated_at(format = nil) click to toggle source

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

url() click to toggle source

URL for this file.

    # File lib/thoth/model/media.rb, line 83
    def url
      Config.site.url.chomp('/') + R(MediaController, filename)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.