るりまサーチ

最速Rubyリファレンスマニュアル検索!
124件ヒット [1-100件を表示] (0.133秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

ARGF.class#each_char -> Enumerator (18245.0)

レシーバに含まれる文字を一文字ずつブロックに渡して評価します。

...t2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_char # => #<Enumerator: ARGF:each_char>
ARGF.each_char{|e|p e}

# => "l"
# "i"
# "n"
# "e"
# "1"
# "\n"
# "l"
# "i"
# "n"
# "e"
# "2"
# "\n"

@
see IO#each_char...

ARGF.class#each_char { |c| ... } -> self (18245.0)

レシーバに含まれる文字を一文字ずつブロックに渡して評価します。

...t2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_char # => #<Enumerator: ARGF:each_char>
ARGF.each_char{|e|p e}

# => "l"
# "i"
# "n"
# "e"
# "1"
# "\n"
# "l"
# "i"
# "n"
# "e"
# "2"
# "\n"

@
see IO#each_char...

String#each_char -> Enumerator (18227.0)

文字列の各文字に対して繰り返します。

...文字列の各文字に対して繰り返します。

たとえば、
//emlist[][ruby]{
"hello世界".each_char {|c| print c, ' ' }
//}
は次のように出力されます。
h e l l o 世 界

@
see String#chars...

String#each_char {|cstr| block } -> self (18227.0)

文字列の各文字に対して繰り返します。

...文字列の各文字に対して繰り返します。

たとえば、
//emlist[][ruby]{
"hello世界".each_char {|c| print c, ' ' }
//}
は次のように出力されます。
h e l l o 世 界

@
see String#chars...

String#chars -> [String] (171.0)

文字列の各文字を文字列の配列で返します。(self.each_char.to_a と同じです)

...。(self.each_char.to_a と同じです)

//emlist[例][ruby]{
"hello世界".chars # => ["h", "e", "l", "l", "o", "世", "界"]
//}

ブロックが指定された場合は String#each_char と同じように動作します。

Ruby
2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警...
...告は削除されました。

@
see String#each_char...

絞り込み条件を変える

String#chars {|cstr| block } -> self (171.0)

文字列の各文字を文字列の配列で返します。(self.each_char.to_a と同じです)

...。(self.each_char.to_a と同じです)

//emlist[例][ruby]{
"hello世界".chars # => ["h", "e", "l", "l", "o", "世", "界"]
//}

ブロックが指定された場合は String#each_char と同じように動作します。

Ruby
2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警...
...告は削除されました。

@
see String#each_char...

Enumerator::Lazy#collect_concat {|item| ... } -> Enumerator::Lazy (143.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 は分解されず、そのままの値として使われます。

//emlist[][ruby]{
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force
#=> [{:a=>1}, {:b=>2}]
//}

@
raise ArgumentError ブロックを指定しなかった場合に発生します。

@
see Enumerable#flat_map...

Enumerator::Lazy#flat_map {|item| ... } -> Enumerator::Lazy (143.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 は分解されず、そのままの値として使われます。

//emlist[][ruby]{
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force
#=> [{:a=>1}, {:b=>2}]
//}

@
raise ArgumentError ブロックを指定しなかった場合に発生します。

@
see Enumerable#flat_map...

Module#instance_method(name) -> UnboundMethod (137.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...undMethod を返します。

@
param name メソッド名を Symbol または String で指定します。

@
raise NameError self に存在しないメソッドを指定した場合に発生します。

@
see Module#public_instance_method, Object#method

//emlist[例][ruby]{
class Interpreter
def...
...d(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end

interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...
<< 1 2 > >>