⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.25
Server IP:
109.199.105.153
Server:
Linux connect.inboxifs.com 5.15.0-152-generic #162-Ubuntu SMP Wed Jul 23 09:48:42 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
CSV
/
Table
/
View File Name :
%5b%5d-i.ri
U:RDoc::AnyMethod[iI"[]:ETI"CSV::Table#[];TF:publico:RDoc::Markup::Document:@parts['o:RDoc::Markup::Paragraph; [I"=Returns data from the table; does not modify the table.;To:RDoc::Markup::BlankLine S:RDoc::Markup::Rule:weighti@o; ; [I"MThe expression <tt>table[n]</tt>, where +n+ is a non-negative \Integer, ;TI"=returns the +n+th row of the table, if that row exists, ;TI"Eand if the access mode is <tt>:row</tt> or <tt>:col_or_row</tt>:;To:RDoc::Markup::Verbatim; [I"2source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" ;TI".table = CSV.parse(source, headers: true) ;TI";table.by_row! # => #<CSV::Table mode:row row_count:4> ;TI"8table[1] # => #<CSV::Row "Name":"bar" "Value":"1"> ;TI"Itable.by_col_or_row! # => #<CSV::Table mode:col_or_row row_count:4> ;TI"8table[1] # => #<CSV::Row "Name":"bar" "Value":"1"> ;T:@format0o; ; [I":Counts backward from the last row if +n+ is negative:;To;; [I"9table[-1] # => #<CSV::Row "Name":"baz" "Value":"2"> ;T;0o; ; [I"4Returns +nil+ if +n+ is too large or too small:;To;; [I"table[4] # => nil ;TI"table[-4] => nil ;T;0o; ; [I"=Raises an exception if the access mode is <tt>:row</tt> ;TI"and +n+ is not an ;TI"�{Integer-convertible object}[https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html#label-Integer-Convertible+Objects].;To;; [I";table.by_row! # => #<CSV::Table mode:row row_count:4> ;TI"I# Raises TypeError (no implicit conversion of String into Integer): ;TI"table['Name'] ;T;0S;; i@o; ; [I"LThe expression <tt>table[range]</tt>, where +range+ is a Range object, ;TI"Ireturns rows from the table, beginning at row <tt>range.first</tt>, ;TI"Zif those rows exist, and if the access mode is <tt>:row</tt> or <tt>:col_or_row</tt>:;To;; [ I"2source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" ;TI".table = CSV.parse(source, headers: true) ;TI";table.by_row! # => #<CSV::Table mode:row row_count:4> ;TI"Brows = table[1..2] # => #<CSV::Row "Name":"bar" "Value":"1"> ;TI"\rows # => [#<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">] ;TI"Itable.by_col_or_row! # => #<CSV::Table mode:col_or_row row_count:4> ;TI"Brows = table[1..2] # => #<CSV::Row "Name":"bar" "Value":"1"> ;TI"\rows # => [#<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">] ;T;0o; ; [I"QIf there are too few rows, returns all from <tt>range.first</tt> to the end:;To;; [I"Crows = table[1..50] # => #<CSV::Row "Name":"bar" "Value":"1"> ;TI"\rows # => [#<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">] ;T;0o; ; [I"SSpecial case: if <tt>range.start == table.size</tt>, returns an empty \Array:;To;; [I"#table[table.size..50] # => [] ;T;0o; ; [I"QIf <tt>range.end</tt> is negative, calculates the ending index from the end:;To;; [I"rows = table[0..-1] ;TI"}rows # => [#<CSV::Row "Name":"foo" "Value":"0">, #<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">] ;T;0o; ; [I"UIf <tt>range.start</tt> is negative, calculates the starting index from the end:;To;; [I"rows = table[-1..2] ;TI"6rows # => [#<CSV::Row "Name":"baz" "Value":"2">] ;T;0o; ; [I"OIf <tt>range.start</tt> is larger than <tt>table.size</tt>, returns +nil+:;To;; [I"table[4..4] # => nil ;T;0S;; i@o; ; [I"IThe expression <tt>table[header]</tt>, where +header+ is a \String, ;TI"Ereturns column values (\Array of \Strings) if the column exists ;TI"Eand if the access mode is <tt>:col</tt> or <tt>:col_or_row</tt>:;To;; [I"2source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" ;TI".table = CSV.parse(source, headers: true) ;TI";table.by_col! # => #<CSV::Table mode:col row_count:4> ;TI".table['Name'] # => ["foo", "bar", "baz"] ;TI"Itable.by_col_or_row! # => #<CSV::Table mode:col_or_row row_count:4> ;TI"col = table['Name'] ;TI"$col # => ["foo", "bar", "baz"] ;T;0o; ; [I"DModifying the returned column values does not modify the table:;To;; [I"col[0] = 'bat' ;TI"$col # => ["bat", "bar", "baz"] ;TI".table['Name'] # => ["foo", "bar", "baz"] ;T;0o; ; [I"BReturns an \Array of +nil+ values if there is no such column:;To;; [I")table['Nosuch'] # => [nil, nil, nil];T;0: @fileI"lib/csv/table.rb;T:0@omit_headings_from_table_of_contents_below0I"Ttable[n] -> row table[range] -> array_of_rows table[header] -> array_of_fields ;T0[ I"(index_or_header);T@}FI" Table;TcRDoc::NormalClass00