Sha256: 5c767dba5f386e208f4eff88f2b60838ebfcc474d117abe5d1b71faf8133f365
Contents?: true
Size: 865 Bytes
Versions: 4
Compression:
Stored size: 865 Bytes
Contents
module Tori class File def initialize(model, from: nil) @model = model @from = from end def name Tori.config.filename_callback.call(@model) end alias to_s name def from? !@from.nil? && @from.respond_to?(:path) end def write path = @from.path path = Pathname.new(path) if path.kind_of?(String) Tori.config.backend.write name, path end def delete Tori.config.backend.delete name if exist? end def respond_to_missing?(sym, include_private) Tori.config.backend.respond_to?(sym, include_private) end def method_missing(sym, *args) if respond_to_missing?(sym, false) Tori.config.backend.__send__ sym, name, *args else fail NameError, "undefined method `#{sym}' for #{Tori.config.backend.inspect}" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tori-0.0.8 | lib/tori/file.rb |
tori-0.0.7 | lib/tori/file.rb |
tori-0.0.6 | lib/tori/file.rb |
tori-0.0.5 | lib/tori/file.rb |