るりまサーチ

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

検索結果

<< < 1 2 3 4 ... > >>

Method#to_s -> String (15131.0)

self を読みやすい文字列として返します。

...るクラス/モジュール名、
method は、メソッド名を表します。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class
Bar
include Foo
def bar
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#...
...
obj = ""
class
<<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo>

# クラスメソッド(クラスの特異メソッド)
class
Foo
def Foo.foo
end
end
p Foo.method(:foo) # => #<Method: Foo.foo>

# スーパークラスのクラスメソッド
class
Bar < Foo
end...
...p Bar.method(:foo) # => #<Method: Bar.foo>

# 以下は(形式1)の出力になる
module Baz
def baz
end
end

class
<<obj
include Baz
end
p obj.method(:baz) # => #<Method: Object(Baz)#baz>
//}

@see Object#inspect...
...ocation を表します。
source_location が nil の場合には付きません。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class
Bar
include Foo
def bar(a, b)
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar)...
...""
class
<<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>

# クラスメソッド(クラスの特異メソッド)
class
Foo
def Foo.foo
end
end
p Foo.method(:foo) # => #<Method: Foo.foo() foo.rb:11>

# スーパークラスのクラスメソッド
class
B...
...ar < Foo
end
p Bar.method(:foo) # => #<Method: Bar(Foo).foo() foo.rb:11>

# 以下は(形式1)の出力になる
module Baz
def baz
end
end

class
<<obj
include Baz
end
p obj.method(:baz) # => #<Method: String(Baz)#baz() foo.rb:23>
//}

@see Object#inspect...

VALUE rb_class_path(VALUE klass) (6128.0)

klass の名前を返します.klassが無名クラス、無名モジュー ルの場合 #<Class 0xXXXX>, #<Module 0xXXXX> の形式で返します。

...klass の名前を返します.klassが無名クラス、無名モジュー
ルの場合 #<Class 0xXXXX>, #<Module 0xXXXX> の形式で返します。

Module#to_s の定義は

rb_str_dup(rb_class_path(klass));

です。...

Object#to_str -> String (6112.0)

オブジェクトの String への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。

...面で代置可能であるような、
* 文字列そのものとみなせるようなもの
という厳しいものになっています。

//emlist[][ruby]{
class
Foo
def to_str
'Edition'
end
end

it = Foo.new
p('Second' + it) #=> "SecondEdition"
//}

@see Object#to_s,Kernel.#String...

Enumerable#to_set(klass = Set, *args) -> Set (6106.0)

Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。

...

//emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
p [30, 10, 20].to_set(SortedSet)
#=> #<SortedSet: {10, 20, 30}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Se...
...rn 生成された集合オブジェクトを返します。

//emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...
...ます。
@return 生成された集合オブジェクトを返します。

//emlist[][ruby]{
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...

Enumerable#to_set(klass = Set, *args) {|o| ... } -> Set (6106.0)

Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。

...

//emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
p [30, 10, 20].to_set(SortedSet)
#=> #<SortedSet: {10, 20, 30}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Se...
...rn 生成された集合オブジェクトを返します。

//emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...
...ます。
@return 生成された集合オブジェクトを返します。

//emlist[][ruby]{
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...

絞り込み条件を変える

ARGF.class#write(str) -> Integer (3022.0)

処理対象のファイルに対して str を出力します。 str が文字列でなければ to_s による文字列化を試みます。 実際に出力できたバイト数を返します。

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

c:ARGF#inplace時にのみ使用できます。

@param str 出力する文字列を指定します。

@see ARGF.class#to_write_io...

REXML::CData#value -> String (3013.0)

テキスト文字列を返します。

...テキスト文字列を返します。

@see REXML::Text#value, REXML::Text#to_s

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root><![CDATA[foobar baz]]></root>
EOS
doc.root[0].class # => REXML::CData
doc.root[0].value # => "foobar baz"
//}...

FalseClass#inspect -> String (3007.0)

常に文字列 "false" を返します。

...常に文字列 "false" を返します。

//emlist[例][ruby]{
false.to_s # => "false"
//}...

ARGF.class#inspect -> String (3001.0)

常に文字列 "ARGF" を返します。

常に文字列 "ARGF" を返します。
<< < 1 2 3 4 ... > >>