Sha256: 48eb437da2f614f22a04abe083338c407b62e42ba33073f7910c41140b1c7c14

Contents?: true

Size: 760 Bytes

Versions: 17

Compression:

Stored size: 760 Bytes

Contents

module LessonsIndexer
  module Addons
    module FileManager
      class Writer
        attr_reader :name

        def initialize(name)
          @name = name
        end

        def prepend_data(data)
          begin
            old_data = File.read(name)
          rescue StandardError => e
            warning `ls`
            warning e.message
          end
          unless old_data.start_with?(data)
            new_data = old_data.prepend(data)
            self << new_data
          end
        end

        def <<(*args)
          begin
            File.open(name, 'w+') { |f| f.write(args.join) }
          rescue StandardError => e
            warning e.message
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lessons_indexer-1.3.0 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-1.2.2 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-1.2.1 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-1.2.0 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-1.1.0 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-1.0.3 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-1.0.2.1 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-1.0.0 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.3.1 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.3.0 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.2.3 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.2.2 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.2.1 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.2.0 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.1.2 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.1.1 lib/lessons_indexer/addons/file_manager.rb
lessons_indexer-0.1.0 lib/lessons_indexer/addons/file_manager.rb