クラス
- CSV (11)
- Encoding (11)
-
Encoding
:: Converter (55) -
Enumerator
:: Lazy (291) -
RDoc
:: Options (33) - Regexp (11)
- String (53)
モジュール
- Enumerable (11)
-
Gem
:: InstallUpdateOptions (11)
キーワード
- chunk (22)
- collect (11)
-
collect
_ concat (11) - drop (11)
-
drop
_ while (11) - filter (6)
-
filter
_ map (5) -
find
_ all (11) -
fixed
_ encoding? (11) -
flat
_ map (11) -
force
_ encoding (11) -
force
_ output (11) -
force
_ output= (11) -
force
_ quotes? (11) -
force
_ update (11) - grep (11)
-
grep
_ v (9) -
insert
_ output (11) -
install
_ update _ defaults _ str (11) - iseuc (11)
- lazy (11)
- map (11)
-
primitive
_ convert (44) - reject (11)
- replicate (11)
- select (11)
-
slice
_ after (20) -
slice
_ before (33) -
slice
_ when (10) - take (11)
-
take
_ while (22) -
unicode
_ normalize (10) -
unicode
_ normalized? (10) -
valid
_ encoding? (11) -
with
_ index (10) - zip (22)
検索結果
先頭5件
-
Enumerator
:: Lazy # force(*args) -> [object] (21108.0) -
全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。
...全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。
Enumerable#to_a のエイリアスです。
//emlist[例][ruby]{
1.step.lazy.take(10).force
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
1.step.lazy.take(10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9,... -
Gem
:: InstallUpdateOptions # install _ update _ defaults _ str -> String (9107.0) -
Gem コマンドの install サブコマンドに渡されるデフォルトのオプションを返します。
...Gem コマンドの install サブコマンドに渡されるデフォルトのオプションを返します。
デフォルトのオプションは以下の通りです。
--rdoc --no-force --no-test --wrappers... -
RDoc
:: Options # force _ output -> bool (6234.0) -
コマンドライン引数の --force_output オプションを指定していた場合、true を返します。--no-force_output オプションを指定していた場合、false を返 します。
...コマンドライン引数の --force_output オプションを指定していた場合、true
を返します。--no-force_output オプションを指定していた場合、false を返
します。
どちらも指定しなかった場合は true を返します。... -
CSV
# force _ quotes? -> bool (6226.0) -
出力される全てのフィールドがクオートされる場合は、真を返します。
...す。
//emlist[例][ruby]{
require "csv"
rows = [["header1", "header2"], ["row1_1,", "row1_2"]]
result = CSV.generate(force_quotes: false) do |csv|
rows.each { |row| csv << row }
csv.force_quotes? # => false
end
print result
# => header1,header2
# "row1_1,",row1_2
//}
//emlist[例][ruby]......{
require "csv"
rows = [["header1", "header2"], ["row1_1,", "row1_2"]]
result = CSV.generate(force_quotes: true) do |csv|
rows.each { |row| csv << row }
csv.force_quotes? # => true
end
print result
# => true
# => "header1","header2"
# "row1_1,","row1_2"
//}
@see CSV.new... -
String
# force _ encoding(encoding) -> self (6226.0) -
文字列の持つエンコーディング情報を指定された encoding に変えます。
...//emlist[例][ruby]{
s = [164, 164, 164, 237, 164, 207].pack("C*")
p s.encoding #=> ASCII-8BIT
p s.force_encoding("EUC-JP") #=> "いろは"
p s.force_encoding(Encoding::EUC_JP) #=> "いろは"
u = [12411, 12408, 12392].pack("U*")
u.force_en......coding("UTF-8") #=> "ほへと"
u.force_encoding(Encoding::UTF_8) #=> "ほへと"
//}... -
RDoc
:: Options # force _ output=(val) (6224.0) -
val に true を指定した場合、コマンドライン引数の --force_output オプショ ンと同様の指定を行います。
...val に true を指定した場合、コマンドライン引数の --force_output オプショ
ンと同様の指定を行います。
@param val --force_output オプションと同じ指定を行う場合は true、そうで
ない場合は false を指定します。... -
Enumerable
# lazy -> Enumerator :: Lazy (6219.0) -
自身を lazy な Enumerator に変換したものを返します。
...身を lazy な Enumerator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reje......ct
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみlazy)
以下はピタゴラス数 (a**2 + b**2 = c**2 を満たす自然数 a, b, c の組)......//emlist[例][ruby]{
def pythagorean_triples
(1..Float::INFINITY).lazy.flat_map {|z|
(1..z).flat_map {|x|
(x..z).select {|y|
x**2 + y**2 == z**2
}.map {|y|
[x, y, z]
}
}
}
end
# 最初の10個のピタゴラス数を表示する
p pythagorean_triples.ta... -
Enumerator
:: Lazy # flat _ map {|item| . . . } -> Enumerator :: Lazy (6219.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
...果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の場......を持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) とき
それ以外のときは、x は分解されず、そのままの値として使われます。
//emlist[][ruby]{
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force
#=> [{:a=>1}, {:b=>2}]
//}
@raise Argume......ntError ブロックを指定しなかった場合に発生します。
@see Enumerable#flat_map... -
RDoc
:: Options # force _ update -> bool (6218.0) -
コマンドライン引数の --force_update を指定していた場合に true を返しま す。そうでない場合は false を返します。
...コマンドライン引数の --force_update を指定していた場合に true を返しま
す。そうでない場合は false を返します。... -
Encoding
# replicate(name) -> Encoding (6119.0) -
レシーバのエンコーディングを複製(replicate)します。 複製されたエンコーディングは元のエンコーディングと同じバイト構造を持たなければなりません。 name という名前のエンコーディングが既に存在する場合は ArgumentError を発生します。
...レシーバのエンコーディングを複製(replicate)します。
複製されたエンコーディングは元のエンコーディングと同じバイト構造を持たなければなりません。
name という名前のエンコーディングが既に存在する場合は ArgumentError......mlist[][ruby]{
encoding = Encoding::UTF_8.replicate("REPLICATED_UTF-8") #=> #<Encoding:REPLICATED_UTF-8>
encoding.name #=> "REPLICATED_UTF-8"
"\u3042".force_encoding(Encoding::UTF_8).valid_encoding? #=> true
"\u3042".force_encoding(encoding).val......id_encoding? #=> true
"\u3042".force_encoding(Encoding::SHIFT_JIS).valid_encoding? #=> false
//}...