るりまサーチ

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

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

OpenURI::OpenRead#read(options = {}) -> String (21139.0)

自身が表す内容を読み込んで文字列として返します。 self.open(options={}) {|io| io.read } と同じです。 このメソッドによって返される文字列は OpenURI::Meta によって extend されています。

...
self
.open(options={}) {|io| io.read } と同じです。
このメソッドによって返される文字列は OpenURI::Meta
によって extend されています。

@param options ハッシュを与えます。

require 'open-uri'
uri = URI.parse('http://www.example.com/')
str = uri.read...

CSV#read -> [Array] | CSV::Table (18141.0)

残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

...残りの行を読み込んで配列の配列を返します。
self
の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

データソースは読み込み用にオープンされている必要があります。...
...e "csv"

csv = CSV.new(DATA.read)
csv.read
# => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]

__END__
header1,header2
row1_1,row1_2
row2_1,row2_2
//}

//emlist[例 headers: true][ruby]{
require "csv"

csv = CSV.new(DATA.read, headers: true)
csv.read
# => #<CSV::Table mode:col...

Pathname#read(*args) -> String | nil (18139.0)

IO.read(self.to_s, *args)と同じです。

...IO.read(self.to_s, *args)と同じです。


@see IO.read...

static VALUE rb_thread_s_abort_exc_set(VALUE self, VALUE val) (6200.0)

Object#yield_self -> Enumerator (6160.0)

self を引数としてブロックを評価し、ブロックの結果を返します。

...
self
を引数としてブロックを評価し、ブロックの結果を返します。

//emlist[例][ruby]{
"my string".yield_self {|s| s.upcase } # => "MY STRING"
3.next.yield_self {|x| x**x }.to_s # => "256"
//}

値をメソッドチェインのパイプラインに次々と渡すの...
...ld_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}

ブロックなしで呼び出されたときは Enumerator を返します。
例えば条件によって値を捨てるのに使えます。

//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.d...
...etect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}

@see Object#tap...

絞り込み条件を変える

Object#yield_self {|x| ... } -> object (6160.0)

self を引数としてブロックを評価し、ブロックの結果を返します。

...
self
を引数としてブロックを評価し、ブロックの結果を返します。

//emlist[例][ruby]{
"my string".yield_self {|s| s.upcase } # => "MY STRING"
3.next.yield_self {|x| x**x }.to_s # => "256"
//}

値をメソッドチェインのパイプラインに次々と渡すの...
...ld_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}

ブロックなしで呼び出されたときは Enumerator を返します。
例えば条件によって値を捨てるのに使えます。

//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.d...
...etect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}

@see Object#tap...

CSV#readlines -> [Array] | CSV::Table (6141.0)

残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

...残りの行を読み込んで配列の配列を返します。
self
の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

データソースは読み込み用にオープンされている必要があります。...
...e "csv"

csv = CSV.new(DATA.read)
csv.read
# => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]

__END__
header1,header2
row1_1,row1_2
row2_1,row2_2
//}

//emlist[例 headers: true][ruby]{
require "csv"

csv = CSV.new(DATA.read, headers: true)
csv.read
# => #<CSV::Table mode:col...

Pathname#binread(*args) -> String | nil (6116.0)

IO.binread(self.to_s, *args)と同じです。

....binread(self.to_s, *args)と同じです。

//emlist[例][ruby]{
require "pathname"

pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(20,...
...10) # => "ne one\nThis is line "
//}

@see IO.binread...

Pathname#readable? -> bool (6116.0)

FileTest.readable?(self.to_s) と同じです。

...FileTest.readable?(self.to_s) と同じです。


@see FileTest.#readable?...

Pathname#readable_real? -> bool (6116.0)

FileTest.readable_real?(self.to_s) と同じです。

...FileTest.readable_real?(self.to_s) と同じです。


@see FileTest.#readable_real?...

絞り込み条件を変える

Pathname#readlines(*args) -> [String] (6116.0)

IO.readlines(self.to_s, *args)と同じです。

...IO.readlines(self.to_s, *args)と同じです。


@see IO.readlines...
<< 1 2 3 ... > >>