るりまサーチ (Ruby 2.1.0)

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

キーワード

検索結果

Thread::Backtrace::Location#to_s -> String (63325.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.to_s
end

# => path/to/foo.rb:5:in `initialize'
# path/to/foo...

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

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

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


@see IO.read

CSV::Table#to_s(options = Hash.new) -> String (45325.0)

CSV の文字列に変換して返します。

CSV の文字列に変換して返します。

ヘッダを一行目に出力します。その後に残りのデータを出力します。

デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。

//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_head...

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

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

IO.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) # => ...

Pathname#readable? -> bool (18352.0)

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

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


@see FileTest.#readable?

絞り込み条件を変える

Pathname#readable_real? -> bool (18352.0)

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

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


@see FileTest.#readable_real?

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

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

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


@see IO.readlines

Pathname#readlink -> Pathname (18352.0)

Pathname.new(File.readlink(self.to_s)) と同じです。

Pathname.new(File.readlink(self.to_s)) と同じです。


@see File.readlink

Pathname#world_readable? -> bool (18352.0)

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

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


@see FileTest.#world_readable?

Thread#set_trace_func(pr) -> Proc | nil (9076.0)

スレッドにトレース用ハンドラを設定します。

スレッドにトレース用ハンドラを設定します。

nil を渡すとトレースを解除します。

設定したハンドラを返します。

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
#...

絞り込み条件を変える

Thread#add_trace_func(pr) -> Proc (9058.0)

スレッドにトレース用ハンドラを追加します。

スレッドにトレース用ハンドラを追加します。

追加したハンドラを返します。

@param pr トレースハンドラ(Proc オブジェクト)

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, ...

Thread::Backtrace::Location#inspect -> String (9052.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.inspect
end

# => "path/to/foo.rb:5:in ...

Zlib::GzipWriter#write(str) -> Integer (88.0)

自身に str を出力します。str が文字列でなけ れば to_s による文字列化を試みます。

自身に str を出力します。str が文字列でなけ
れば to_s による文字列化を試みます。

@param str 出力する文字列を指定します。文字列でない場合は to_s で文字列に変換します。

@return 実際に出力できたバイト数を返します。

require 'zlib'

filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.write "foo"
}
fr = File.open...

IO#syswrite(string) -> Integer (70.0)

write(2) を用いて string を出力します。 string が文字列でなければ to_s による文字列化を試みます。 実際に出力できたバイト数を返します。

write(2) を用いて string を出力します。
string が文字列でなければ to_s による文字列化を試みます。
実際に出力できたバイト数を返します。

stdio を経由しないので他の出力メソッドと混用すると思わぬ動作
をすることがあります。

@param string 自身に書き込みたい文字列を指定します。

@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX 出力に失敗した場合に発生します。

//emlist[例][ruby]{
File.open("testfile", "w+") do |...

IO#write(str) -> Integer (70.0)

IOポートに対して str を出力します。str が文字列でなけ れば to_s による文字列化を試みます。 実際に出力できたバイト数を返します。

IOポートに対して str を出力します。str が文字列でなけ
れば to_s による文字列化を試みます。
実際に出力できたバイト数を返します。

IO#syswrite を除く全ての出力メソッドは、最終的に
"write" という名のメソッドを呼び出すので、このメソッドを置き換える
ことで出力関数の挙動を変更することができます。

@param str 自身に書き込みたい文字列を指定します。

@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX 出力に失敗した場合に発生します。

//emlist[例][ruby]...

絞り込み条件を変える

Zlib::GzipWriter#<<(str) -> self (70.0)

str を出力します。str が文字列でない場合は to_s を用いて 文字列に変換します。

str を出力します。str が文字列でない場合は to_s を用いて
文字列に変換します。

@param str 出力したいオブジェクトを与えます。

require 'zlib'

filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz << "hoge" << "fuga"
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
...

CSV::Table#to_csv(options = Hash.new) -> String (25.0)

CSV の文字列に変換して返します。

CSV の文字列に変換して返します。

ヘッダを一行目に出力します。その後に残りのデータを出力します。

デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。

//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_head...