Sha256: 19e64510a149e7857b512a86d324e8262ec340a2c8d41b89677b81470991159b

Contents?: true

Size: 973 Bytes

Versions: 4

Compression:

Stored size: 973 Bytes

Contents

class RemoteTable  
  class Format
    class Unknown < StandardError; end
    
    autoload :Excel, 'remote_table/format/excel'
    autoload :Excelx, 'remote_table/format/excelx'
    autoload :Delimited, 'remote_table/format/delimited'
    autoload :OpenOffice, 'remote_table/format/open_office'
    autoload :FixedWidth, 'remote_table/format/fixed_width'
    autoload :HTML, 'remote_table/format/html'
    
    autoload :Textual, 'remote_table/format/mixins/textual'
    autoload :Rooable, 'remote_table/format/mixins/rooable'
    
    attr_reader :t

    def initialize(t)
      @t = t
    end
    
    include ::Enumerable
    def each
      raise "must be defined by format"
    end
    
    def backup_file!
      ::FileUtils.cp t.local_file.path, "#{t.local_file.path}.backup"
    end
    
    def restore_file!
      return unless ::File.readable? "#{t.local_file.path}.backup"
      ::FileUtils.mv "#{t.local_file.path}.backup", t.local_file.path
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
remote_table-1.0.3 lib/remote_table/format.rb
remote_table-1.0.2 lib/remote_table/format.rb
remote_table-1.0.1 lib/remote_table/format.rb
remote_table-1.0.0 lib/remote_table/format.rb