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
#exif, #exif?, recognized?, #x_size, #y_size
Constructor Details
#initialize(path, options = {}) ⇒ CSVReader
Creates a CSV reader.
111 112 113 114 115 116 117 118 |
# File 'lib/vips/reader.rb', line 111 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.
107 108 109 |
# File 'lib/vips/reader.rb', line 107 def line_limit @line_limit end |
#line_skip ⇒ Object
Returns the value of attribute line_skip.
107 108 109 |
# File 'lib/vips/reader.rb', line 107 def line_skip @line_skip end |
#separator ⇒ Object
Returns the value of attribute separator.
108 109 110 |
# File 'lib/vips/reader.rb', line 108 def separator @separator end |
#whitespace ⇒ Object
Returns the value of attribute whitespace.
108 109 110 |
# File 'lib/vips/reader.rb', line 108 def whitespace @whitespace end |
Instance Method Details
#read ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'lib/vips/reader.rb', line 120 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_retry str, 0 end |