433件ヒット
[101-200件を表示]
(0.032秒)
ライブラリ
- ビルトイン (230)
- csv (150)
- date (4)
- forwardable (24)
- prettyprint (1)
-
rexml
/ document (24)
クラス
- Array (36)
- CSV (120)
-
CSV
:: FieldInfo (24) -
CSV
:: Row (6) - Date (2)
- DateTime (2)
-
Enumerator
:: Lazy (48) - Object (48)
- PrettyPrint (1)
-
REXML
:: Attributes (24) - Range (72)
-
RubyVM
:: InstructionSequence (12) - Time (2)
モジュール
- Enumerable (12)
- Forwardable (24)
キーワード
- << (12)
- []= (36)
-
add
_ row (12) - begin (12)
- convert (36)
- deconstruct (3)
-
deconstruct
_ keys (9) - delegate (12)
- each (24)
-
each
_ attribute (12) -
enum
_ for (48) - first? (1)
-
first
_ lineno (12) - header (12)
-
header
_ convert (36) - index (12)
-
instance
_ delegate (12) - last (24)
- lazy (12)
- puts (12)
-
to
_ enum (48)
検索結果
先頭5件
-
Range
# begin -> object (44.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... -
CSV
# <<(row) -> self (43.0) -
自身に row を追加します。
..."csv"
File.write("test.csv", <<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.open("test.csv", "a") do |csv|
csv.puts(["5", "saburo", "kondo", "34"])
end
print File.read("test.csv")
# => id,first name,last name,age
# 1,taro,tanaka,20......id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
row = CSV::Row.new(["id", "first name", "last name", "age"], ["5", "saburo", "kondo", "34"])
csv.add_row(row)
end
print File.read("test.csv")
# => "id", first nam... -
CSV
# add _ row(row) -> self (43.0) -
自身に row を追加します。
..."csv"
File.write("test.csv", <<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.open("test.csv", "a") do |csv|
csv.puts(["5", "saburo", "kondo", "34"])
end
print File.read("test.csv")
# => id,first name,last name,age
# 1,taro,tanaka,20......id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
row = CSV::Row.new(["id", "first name", "last name", "age"], ["5", "saburo", "kondo", "34"])
csv.add_row(row)
end
print File.read("test.csv")
# => "id", first nam... -
CSV
# puts(row) -> self (43.0) -
自身に row を追加します。
..."csv"
File.write("test.csv", <<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.open("test.csv", "a") do |csv|
csv.puts(["5", "saburo", "kondo", "34"])
end
print File.read("test.csv")
# => id,first name,last name,age
# 1,taro,tanaka,20......id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
row = CSV::Row.new(["id", "first name", "last name", "age"], ["5", "saburo", "kondo", "34"])
csv.add_row(row)
end
print File.read("test.csv")
# => "id", first nam... -
Date
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (37.0) -
パターンマッチに使用する名前と値の Hash を返します。
...uct_keys が使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される
case d
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#=> "working day in month 10" が......出力される
# クラスのチェックと組み合わせて利用することもできます
if d in Date(wday: 3, day: ..7)
puts "first Wednesday of the month"
end
//}
@see d:spec/pattern_matching#matching_non_primitive_objects... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) -> Enumerator :: Lazy (37.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげ... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (37.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげ... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) -> Enumerator :: Lazy (37.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげ... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (37.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげ... -
Object
# enum _ for(method = :each , *args) -> Enumerator (37.0) -
Enumerator.new(self, method, *args) を返します。
...sz = size
sz * n if sz
end
end
each do |*val|
n.times { yield *val }
end
end
end
%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size...