372件ヒット
[1-100件を表示]
(0.052秒)
ライブラリ
- ビルトイン (230)
- csv (114)
- date (4)
-
rexml
/ document (24)
クラス
- Array (36)
- CSV (84)
-
CSV
:: FieldInfo (24) -
CSV
:: Row (6) - Date (2)
- DateTime (2)
-
Enumerator
:: Lazy (48) - Object (48)
-
REXML
:: Attributes (24) - Range (72)
-
RubyVM
:: InstructionSequence (12) - Time (2)
モジュール
- Enumerable (12)
キーワード
- << (12)
- []= (36)
-
add
_ row (12) - begin (12)
- convert (36)
- deconstruct (3)
-
deconstruct
_ keys (9) - each (24)
-
each
_ attribute (12) -
enum
_ for (48) -
first
_ lineno (12) - header (12)
- index (12)
- last (24)
- lazy (12)
- puts (12)
-
to
_ enum (48)
検索結果
先頭5件
-
Range
# end -> object (18211.0) -
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。
...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。
//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}
@see Range#begin... -
Range
# first -> object (15253.0) -
始端の要素を返します。 始端を持たない範囲オブジェクトの場合、begin はnilを返しますが, first は例外 RangeError が発生します。
...しますが, first は例外 RangeError が発生します。
//emlist[例][ruby]{
# 始端を持つ場合
p (1..5).begin # => 1
p (1..0).begin # => 1
p (1..5).first # => 1
p (1..0).first # => 1
# 始端を持たない場合
p (..5).begin #=> nil
p (..5).first #=> RangeError
//}
@see Range#end... -
Range
# first(n) -> [object] (15233.0) -
最初の n 要素を返します。範囲内に要素が含まれない場合は空の配列を返します。
...に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
@raise ArgumentError n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
(10..20).first(3) # => [10, 11, 12]
//}
@see Range#last, 12697... -
RubyVM
:: InstructionSequence # first _ lineno -> Integer (9226.0) -
self が表す命令シーケンスの 1 行目の行番号を返します。
...の 1 行目の行番号を返します。
例1:irb で実行した場合
RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1
例2:
# /tmp/method.rb
require "foo-library"
def foo
p :foo
end
RubyVM::InstructionSequence.of(method(:foo)).first_lineno
# => 2... -
Range
# last(n) -> [object] (3121.0) -
最後の n 要素を返します。範囲内に要素が含まれない場合は空の配列を返します。
...引数を省略して実行した場合は、終端を含むかどうか
(Range#exclude_end? の戻り値)に関わらず終端の要素を返す事に注意し
てください。
//emlist[例][ruby]{
(10..20).last(3) # => [18, 19, 20]
(10...20).last(3) # => [17, 18, 19]
//}
@see Range#first... -
Range
# last -> object (3111.0) -
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。
...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。
//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}
@see Range#begin... -
CSV
# each {|row| . . . } -> nil (167.0) -
各行に対してブロックを評価します。
...der => true を指定した場合][ruby]{
require "csv"
users = <<CSV
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.new(users, headers: true)
csv.each do |row|
p row
end
# => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka"......d":"2" "first name":"jiro" "last name":"suzuki" "age":"18">
# => #<CSV::Row "id":"3" "first name":"ami" "last name":"sato" "age":"19">
# => #<CSV::Row "id":"4" "first name":"yumi" "last name":"adachi" "age":"21">
//}
//emlist[例 CSV.new 時に :header => true を指定しない場合][ruby]{
requi......re "csv"
users = <<CSV
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.new(users)
csv.each do |row|
p row
end
# => ["id", "first name", "last name", "age"]
# => ["1", "taro", "tanaka", "20"]
# => ["2", "jiro", "suzuki", "18"]
# => ["3",... -
CSV
:: FieldInfo # header -> String | nil (167.0) -
利用可能な場合はヘッダを表す文字列を返します。
...ます。
//emlist[例][ruby]{
require 'csv'
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.header
Date.parse(field)
end
p csv.first
# => "date1"
# => "date2"
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,0s,0n),+0s,22......99161j)> "date2":#<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>>
//}... -
CSV
:: FieldInfo # index -> Integer (167.0) -
行内で何番目のフィールドかわかるゼロベースのインデックスを返します。
...][ruby]{
require 'csv'
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.index
Date.parse(field)
end
p csv.first
# => 0
# => 1
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)> "date2":#<Date: 2018-07-10...