Sha256: 284be6ad568f557017d8776b197d3f028f4bb933629829add42f70e7b4531c77

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

module Tori
  class File
    attr_accessor :from

    def initialize(model, from = nil)
      @model = model
      @from = from
    end

    def to_s
      Tori.config.filename_callback.call(@model)
    end

    def exist?
      Tori.config.backend.exist?(to_s)
    end

    def copy?
      !@model.nil? && !@from.nil? && @from.respond_to?(:path) && 0 < to_s.length
    rescue NameError => e
      false
    end

    def read
      Tori.config.backend.read(to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tori-0.0.3 lib/tori/file.rb