Class: VIPS::CSVReader
- Defined in:
- lib/vips/reader.rb,
ext/reader.c
Instance Attribute Summary collapse
-
#line_limit ⇒ Object
Returns the value of attribute line_limit.
-
#line_skip ⇒ Object
Returns the value of attribute line_skip.
-
#separator ⇒ Object
Returns the value of attribute separator.
-
#whitespace ⇒ Object
Returns the value of attribute whitespace.
Attributes inherited from Reader
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ CSVReader
constructor
Creates a CSV reader.
- #read ⇒ Object
Methods inherited from Reader
Methods included from Header
#band_fmt, #bands, #exif, #exif?, #get, #icc, #icc?, #n_elements, #set, #sizeof_element, #sizeof_line, #sizeof_pel, #x_offset, #x_res, #x_size, #y_offset, #y_res, #y_size
Constructor Details
#initialize(path, options = {}) ⇒ CSVReader
Creates a CSV reader.
76 77 78 79 80 81 82 83 |
# File 'lib/vips/reader.rb', line 76 def initialize(path, ={}) @line_skip = [:line_skip] || 0 @whitespace = [:whitespace] || ' "' @separator = [:separator] || ";,\t" @line_limit = [:line_limit] || 0 super path, end |
Instance Attribute Details
#line_limit ⇒ Object
Returns the value of attribute line_limit.
72 73 74 |
# File 'lib/vips/reader.rb', line 72 def line_limit @line_limit end |
#line_skip ⇒ Object
Returns the value of attribute line_skip.
72 73 74 |
# File 'lib/vips/reader.rb', line 72 def line_skip @line_skip end |
#separator ⇒ Object
Returns the value of attribute separator.
73 74 75 |
# File 'lib/vips/reader.rb', line 73 def separator @separator end |
#whitespace ⇒ Object
Returns the value of attribute whitespace.
73 74 75 |
# File 'lib/vips/reader.rb', line 73 def whitespace @whitespace end |
Instance Method Details
#read ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/vips/reader.rb', line 85 def read str = "#{@path}:ski:#{@line_skip},whi:#{@whitespace}" str << ",lin:#{@line_limit == 0 ? -1 : @line_limit}" # VIPS magic open path limitation/bug -- we cannot specify the comma char str << ",sep:#{@separator}" unless @separator[/,/] @_im = read_internal str, 0 end |