method
inspect
v2_4_6 -
Show latest stable
- Class:
CSV
inspect()public
# File lib/csv.rb, line 1961
def inspect
str = ["<#", self.class.to_s, " io_type:"]
# show type of wrapped IO
if @io == $stdout then str << "$stdout"
elsif @io == $stdin then str << "$stdin"
elsif @io == $stderr then str << "$stderr"
else str << @io.class.to_s
end
# show IO.path(), if available
if @io.respond_to?(:path) and (p = @io.path)
str << " io_path:" << p.inspect
end
# show encoding
str << " encoding:" << @encoding.name
# show other attributes
] lineno col_sep row_sep
quote_char skip_blanks liberal_parsing ].each do |attr_name|
if a = instance_variable_get("@#{attr_name}")
str << " " << attr_name << ":" << a.inspect
end
end
if @use_headers
str << " headers:" << headers.inspect
end
str << ">"
begin
str.join('')
rescue # any encoding error
str.map do |s|
e = Encoding::Converter.asciicompat_encoding(s.encoding)
e ? s.encode(e) : s.force_encoding("ASCII-8BIT")
end.join('')
end
end Related methods
- Instance methods
- <<
- add_row
- convert
- converters
- each
- force_quotes?
- gets
- header_convert
- header_converters
- header_row?
- headers
- inspect
- liberal_parsing?
- puts
- read
- readline
- readlines
- return_headers?
- rewind
- shift
- skip_blanks?
- unconverted_fields?
- write_headers?
- Class methods
- filter
- foreach
- generate
- generate_line
- instance
- new
- open
- parse
- parse_line
- read
- readlines
- table
- Private methods
-
add_converter -
add_unconverted_fields -
convert_fields -
encode_re -
encode_str -
escape_re -
init_comments -
init_converters -
init_headers -
init_parsers -
init_separators -
parse_headers -
raw_encoding