Class: Plaintext::FileHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/plaintext/file_handler.rb

Instance Method Summary collapse

Instance Method Details

#accept?(content_type) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
# File 'lib/plaintext/file_handler.rb', line 5

def accept?(content_type)
  if @content_type
    content_type == @content_type
  elsif @content_types
    @content_types.include? content_type
  else
    false
  end
end

#set(args = {}) ⇒ Object

use ‘#set(max_size: 1.megabyte)` to give an upper limit of data to be read.

By default, all data (whole file / command output) will be read which can be a problem with huge text files (eg SQL dumps)



19
20
21
22
# File 'lib/plaintext/file_handler.rb', line 19

def set(args = {})
  options.update args
  self
end