クラス
- CSV (1)
- Encoding (1)
-
Encoding
:: Converter (5) -
Enumerator
:: Lazy (29) - Regexp (1)
- String (5)
モジュール
- Enumerable (1)
キーワード
- chunk (2)
- collect (1)
-
collect
_ concat (1) - drop (1)
-
drop
_ while (1) - filter (1)
-
filter
_ map (1) -
find
_ all (1) -
fixed
_ encoding? (1) -
flat
_ map (1) -
force
_ encoding (1) -
force
_ quotes? (1) - grep (1)
-
grep
_ v (1) -
insert
_ output (1) - iseuc (1)
- lazy (1)
- map (1)
-
primitive
_ convert (4) - reject (1)
- replicate (1)
- select (1)
-
slice
_ after (2) -
slice
_ before (3) -
slice
_ when (1) - take (1)
-
take
_ while (2) -
unicode
_ normalize (1) -
unicode
_ normalized? (1) -
valid
_ encoding? (1) -
with
_ index (2) - zip (2)
検索結果
先頭5件
-
Enumerator
:: Lazy # force(*args) -> [object] (63343.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, 10]
//} -
CSV
# force _ quotes? -> bool (18715.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... -
String
# force _ encoding(encoding) -> self (18697.0) -
文字列の持つエンコーディング情報を指定された encoding に変えます。
文字列の持つエンコーディング情報を指定された encoding に変えます。
このとき実際のエンコーディングは変換されず、検査もされません。
Array#pack などで得られたバイト列のエンコーディングを指定する時に使います。
@param encoding 変更するエンコーディング情報を表す文字列か Encoding オブジェクトを指定します。
//emlist[例][ruby]{
s = [164, 164, 164, 237, 164, 207].pack("C*")
p s.encoding #=> ASC... -
Enumerator
:: Lazy # flat _ map {|item| . . . } -> Enumerator :: Lazy (18694.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 が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
Enumerable
# lazy -> Enumerator :: Lazy (18676.0) -
自身を lazy な Enumerator に変換したものを返します。
自身を lazy な Enumerator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみl... -
Encoding
# replicate(name) -> Encoding (18412.0) -
レシーバのエンコーディングを複製(replicate)します。 複製されたエンコーディングは元のエンコーディングと同じバイト構造を持たなければなりません。 name という名前のエンコーディングが既に存在する場合は ArgumentError を発生します。
レシーバのエンコーディングを複製(replicate)します。
複製されたエンコーディングは元のエンコーディングと同じバイト構造を持たなければなりません。
name という名前のエンコーディングが既に存在する場合は ArgumentError を発生します。
Ruby 3.2 から非推奨となり、Ruby 3.3 で削除予定です。
//emlist[][ruby]{
encoding = Encoding::UTF_8.replicate("REPLICATED_UTF-8") #=> #<Encoding:REPLICATED_UTF-8>
encoding.name ... -
Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy (18394.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 が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
String
# valid _ encoding? -> bool (18376.0) -
文字列の内容が、現在のエンコーディングに照らしあわせて妥当であれば true を返します。さもなくば false を返します。
文字列の内容が、現在のエンコーディングに照らしあわせて妥当であれば
true を返します。さもなくば false を返します。
//emlist[例][ruby]{
"\xc2\xa1".force_encoding("UTF-8").valid_encoding? #=> true
"\xc2".force_encoding("UTF-8").valid_encoding? #=> false
"\x80".force_encoding("UTF-8").valid_encoding? #=> false
//} -
Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy (18340.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.map{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:map>
1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8,... -
Enumerator
:: Lazy # drop _ while {|item| . . . } -> Enumerator :: Lazy (18340.0) -
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.drop_while { |i| i < 42 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop_while>
1.step.lazy.drop_while { |i| i < 42 }.take(10).force
# => [42, 43, 44, 45, 46, 47, 48, 49, 50, 51]
//... -
Enumerator
:: Lazy # filter {|item| . . . } -> Enumerator :: Lazy (18340.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # filter _ map {|item| . . . } -> Enumerator :: Lazy (18340.0) -
Enumerable#filter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#filter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.filter_map { |n| n * 2 if n.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: (1.step)>:filter_map>
1.step.lazy.filter_map { |n| n * 2 if n.even? }.take(10).fo... -
Enumerator
:: Lazy # find _ all {|item| . . . } -> Enumerator :: Lazy (18340.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # select {|item| . . . } -> Enumerator :: Lazy (18340.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # slice _ after {|elt| bool } -> Enumerator :: Lazy (18340.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>
1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [... -
Enumerator
:: Lazy # slice _ after(pattern) -> Enumerator :: Lazy (18340.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>
1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [... -
Enumerator
:: Lazy # slice _ before {|elt| bool } -> Enumerator :: Lazy (18340.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ before(initial _ state) {|elt , state| bool } -> Enumerator :: Lazy (18340.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ before(pattern) -> Enumerator :: Lazy (18340.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ when {|elt _ before , elt _ after| bool } -> Enumerator :: Lazy (18340.0) -
Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007fce84118348>:each>>
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }.take(5).force
# => [[1, 2]... -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (18340.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.... -
Enumerator
:: Lazy # take _ while {|item| . . . } -> Enumerator :: Lazy (18340.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.... -
String
# unicode _ normalize(form = :nfc) -> String (18340.0) -
self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し た文字列を返します。
self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し
た文字列を返します。
@param form 正規化形式を :nfc、:nfd、:nfkc、:nfkd のいずれかで指定しま
す。省略した場合は :nfc になります。
@raise Encoding::CompatibilityError self が Unicode 文字列ではない場合
に発生します。
このメソッドでの "Unicode 文字列" とは、UTF-8、UTF-16BE/LE... -
String
# unicode _ normalized?(form = :nfc) -> bool (18340.0) -
self が引数 form で指定された正規化形式で Unicode 正規化された文字列か どうかを返します。
self が引数 form で指定された正規化形式で Unicode 正規化された文字列か
どうかを返します。
@param form 正規化形式を :nfc、:nfd、:nfkc、:nfkd のいずれかで指定しま
す。省略した場合は :nfc になります。
@raise Encoding::CompatibilityError self が Unicode 文字列ではない場合
に発生します。
//emlist[例][ruby]{
"a\u0300".unicode_normalized? ... -
Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy (9340.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # chunk(initial _ state) {|elt , state| . . . } -> Enumerator :: Lazy (9340.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # drop(n) -> Enumerator :: Lazy (9340.0) -
Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。
@param n 要素数を指定します。
@raise ArgumentError n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
1.step.lazy.drop(3)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop(3)>
1.step.lazy.drop(3).take(10).force
# => [4, 5, 6, 7, 8, 9, 10, 1... -
Enumerator
:: Lazy # grep(pattern) {|item| . . . } -> Enumerator :: Lazy (9340.0) -
Enumerable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep(/\A(\d)\1+\z/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/).... -
Enumerator
:: Lazy # grep _ v(pattern) {|item| . . . } -> Enumerator :: Lazy (9340.0) -
Enumerable#grep_v と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#grep_v と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep_v(/(\d).*\1/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep_v(/(\d).*\1/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep_v(/(\d).*\1/).t... -
Enumerator
:: Lazy # map {|item| . . . } -> Enumerator :: Lazy (9340.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.map{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:map>
1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8,... -
Enumerator
:: Lazy # reject {|item| . . . } -> Enumerator :: Lazy (9340.0) -
Enumerable#reject と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#reject と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.reject { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:reject>
1.step.lazy.reject { |i| i.even? }.take(10).force
# => [1, 3, 5, 7, ... -
Enumerator
:: Lazy # take(n) -> Enumerator :: Lazy (9340.0) -
Enumerable#take と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take と同じですが、配列ではなくEnumerator::Lazy を返します。
n が大きな数 (100000とか) の場合に備えて再定義されています。
配列が必要な場合は Enumerable#first を使って下さい。
@param n 要素数を指定します。
@raise ArgumentError n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
1.step.lazy.take(5)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:... -
Enumerator
:: Lazy # with _ index(offset = 0) -> Enumerator :: Lazy (9340.0) -
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。
インデックスは offset から始まります。
ブロックを指定した場合の戻り値は生成時に指定したレシーバ自身です。
//emlist[][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}
@see Enumerator#with_index -
Enumerator
:: Lazy # with _ index(offset = 0) {|(*args) , idx| . . . } -> Enumerator :: Lazy (9340.0) -
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。
インデックスは offset から始まります。
ブロックを指定した場合の戻り値は生成時に指定したレシーバ自身です。
//emlist[][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}
@see Enumerator#with_index -
Enumerator
:: Lazy # zip(*lists) -> Enumerator :: Lazy (9340.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle)... -
Enumerator
:: Lazy # zip(*lists) {|v1 , v2 , . . . | . . . } -> nil (9340.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle)... -
Regexp
# fixed _ encoding? -> bool (430.0) -
正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
//emlist[例][ruby]{
# -*- coding:utf-8 -*-
r = /a/
r.fixed_encoding? # => false
r.encoding # => #<Encoding:US-ASCII>
r =~ "\u{6666} a" # => 2
r =~ "\xa1\... -
Encoding
:: Converter # insert _ output(string) -> nil (358.0) -
変換器内のバッファに文字列を挿入します。 バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換器内のバッファに文字列を挿入します。
バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換先がステートフルなエンコーディングであった場合、
挿入された文字列は状態に基づいて変換され、状態を更新します。
このメソッドは変換に際してエラーが発生した際にのみ利用されるべきです。
@param string 挿入する文字列
//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
src = "HIRAGANA LETTER A is \u{3042}."
dst = ""
p ec.... -
String
# iseuc -> bool (358.0) -
self が EUC-JP なバイト列として正当であるかどうかを判定します。
self が EUC-JP なバイト列として正当であるかどうかを判定します。
Kconv.#iseuc(self) と同じです。
//emlist[例][ruby]{
require 'kconv'
euc_str = "\
\xa5\xaa\xa5\xd6\xa5\xb8\xa5\xa7\xa5\xaf\xa5\xc8\xbb\xd8\xb8\xfe\
\xa5\xd7\xa5\xed\xa5\xb0\xa5\xe9\xa5\xdf\xa5\xf3\xa5\xb0\xb8\xc0\xb8\xec\
\x52\x75\x62\x79".force_encoding('EUC-JP')
... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer) -> Symbol (340.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (340.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (340.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (340.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...