⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
ri
/
3.0.0
/
system
/
CSV
/
View File Name :
convert-i.ri
U:RDoc::AnyMethod[iI"convert:ETI"CSV#convert;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0; [o:RDoc::Markup::Paragraph; [I"9With no block, installs a field converter (a \Proc).;To;;0; [o;; [I"AWith a block, defines and installs a custom field converter.;To;;0; [o;; [I"6Returns the \Array of installed field converters.;To:RDoc::Markup::BlankLine o;;0; [o;; [I"=Argument +converter_name+, if given, should be the name ;TI"$of an existing field converter.;T@o;; [I"?See {Field Converters}[#class-CSV-label-Field+Converters].;TS:RDoc::Markup::Rule:weighti@o;; [I"/With no block, installs a field converter:;To:RDoc::Markup::Verbatim; [ I"csv = CSV.new('') ;TI"csv.convert(:integer) ;TI"csv.convert(:float) ;TI"csv.convert(:date) ;TI"3csv.converters # => [:integer, :float, :date] ;T:@format0S;;i@o;; [I"3The block, if given, is called for each field:;To; ;;; [o;;0; [o;; [I")Argument +field+ is the field value.;To;;0; [o;; [I"6Argument +field_info+ is a CSV::FieldInfo object ;TI"(containing details about the field.;T@o;; [I"5The examples here assume the prior execution of:;To;; [I"&string = "foo,0\nbar,1\nbaz,2\n" ;TI"path = 't.csv' ;TI"File.write(path, string) ;T;0o;; [I"Example giving a block:;To;; [I"csv = CSV.open(path) ;TI"Lcsv.convert {|field, field_info| p [field, field_info]; field.upcase } ;TI">csv.read # => [["FOO", "0"], ["BAR", "1"], ["BAZ", "2"]] ;T;0o;; [I"Output:;To;; [I"C["foo", #
] ;TI"A["0", #
] ;TI"C["bar", #
] ;TI"A["1", #
] ;TI"C["baz", #
] ;TI"A["2", #
] ;T;0o;; [I"0The block need not return a \String object:;To;; [I"csv = CSV.open(path) ;TI"5csv.convert {|field, field_info| field.to_sym } ;TI">csv.read # => [[:foo, :"0"], [:bar, :"1"], [:baz, :"2"]] ;T;0o;; [I";If +converter_name+ is given, the block is not called:;To;; [I"csv = CSV.open(path) ;TI"Gcsv.convert(:integer) {|field, field_info| fail 'Cannot happen' } ;TI"8csv.read # => [["foo", 0], ["bar", 1], ["baz", 2]] ;T;0S;;i@o;; [I"URaises a parse-time exception if +converter_name+ is not the name of a built-in ;TI"field converter:;To;; [ I"csv = CSV.open(path) ;TI"#csv.convert(:nosuch) => [nil] ;TI"H# Raises NoMethodError (undefined method `arity' for nil:NilClass) ;TI" csv.read;T;0: @fileI"lib/csv.rb;T:0@omit_headings_from_table_of_contents_below0I"dconvert(converter_name) -> array_of_procs convert {|field, field_info| ... } -> array_of_procs ;T0[ I"(name = nil, &converter);T@xFI"CSV;TcRDoc::NormalClass00