Module: DaruLite::IOHelpers

Defined in:
lib/daru_lite/io/io.rb

Class Method Summary collapse

Class Method Details

.open_local_or_remote_file(path) ⇒ Object



19
20
21
22
# File 'lib/daru_lite/io/io.rb', line 19

def open_local_or_remote_file(path)
  uri = URI.parse(path)
  uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS) ? uri.open : File.open(uri.path)
end

.process_row(row, empty) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/daru_lite/io/io.rb', line 5

def process_row(row, empty)
  row.to_a.map do |c|
    if empty.include?(c)
      # FIXME: As far as I can guess, it will never work.
      # It is called only inside `from_plaintext`, and there
      # data is splitted by `\s+` -- there is no chance that
      # "empty" (currently just '') will be between data?..
      nil
    else
      try_string_to_number(c)
    end
  end
end