Sha256: a85daa860aee2af175ce7cf9cbf6eb90ef56702af3d3b48f9ccecb0f55d1fa2d

Contents?: true

Size: 805 Bytes

Versions: 27

Compression:

Stored size: 805 Bytes

Contents

require 'talia_core/data_types/file_store'

# Class to manage data stored in a text file
module TaliaCore
  module DataTypes
  
    class SimpleText < FileRecord
      
      # return the mime_type for a file
      def extract_mime_type(location)
        'text/plain'
      end

      # Get a line from a text file.
      # At the end of file: close the file and return
      def get_line(close_after_single_read=false)
        if !is_file_open?
          open_file
        end
      
        # get a new line and return nil is EOF
        line = @file_handle.gets
      
        if line == nil or close_after_single_read
          close_file
        end
      
        # update the position of reading cursors
        @position += line.length
      
        return line
      end
      
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
talia_core-0.4.6 lib/talia_core/data_types/simple_text.rb
talia_core-0.4.5 lib/talia_core/data_types/simple_text.rb
talia_core-0.4.4 lib/talia_core/data_types/simple_text.rb
talia_core-0.4.3 lib/talia_core/data_types/simple_text.rb
talia_core-0.4.2 lib/talia_core/data_types/simple_text.rb
talia_core-0.4.1 lib/talia_core/data_types/simple_text.rb
talia_core-0.4.0 lib/talia_core/data_types/simple_text.rb