725件ヒット
[1-100件を表示]
(0.326秒)
種類
- インスタンスメソッド (670)
- クラス (22)
- モジュール関数 (22)
- 特異メソッド (11)
ライブラリ
- ビルトイン (725)
クラス
- BasicObject (11)
- Bignum (6)
- Fixnum (6)
- Hash (66)
- IO (11)
- Integer (22)
- MatchData (11)
- Method (10)
- Module (33)
- Object (70)
- String (55)
- Symbol (289)
- Thread (36)
-
Thread
:: Backtrace :: Location (22) - UnboundMethod (33)
モジュール
- Kernel (22)
キーワード
- % (11)
- << (11)
- =~ (11)
- Location (11)
- Symbol (11)
- [] (55)
-
add
_ trace _ func (11) -
all
_ symbols (11) - capitalize (11)
-
define
_ singleton _ method (22) - downcase (11)
-
end
_ with? (5) - format (11)
- id2name (11)
- inspect (62)
- intern (11)
- length (11)
- match (11)
-
method
_ missing (11) - name (15)
- next (11)
- oct (11)
- owner (11)
-
set
_ trace _ func (11) - size (11)
- slice (55)
- sprintf (11)
-
start
_ with? (5) - succ (11)
- swapcase (11)
- then (12)
-
to
_ i (11) -
to
_ proc (11) -
to
_ str (11) -
to
_ sym (22) -
transform
_ keys (17) -
transform
_ keys! (17) -
transform
_ values (16) -
transform
_ values! (16) - upcase (11)
-
yield
_ self (14)
検索結果
先頭5件
-
Object
# to _ s -> String (29113.0) -
オブジェクトの文字列表現を返します。
...使って文字列に変換し
ます。
//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)
puts it #=> #<Foo:0x2b69110>
class Foo
def to_s
"Class:Foo Number:#{@num}"
end
end
puts it #=> Class:Foo Number:40
//}
@see Object#to_str,Kernel.#String... -
Thread
:: Backtrace :: Location # to _ s -> String (29107.0) -
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.rb:9:in `new'
# path/to/foo.rb:9:in `<main>'
/... -
Bignum
# to _ s(base = 10) -> String (26231.0) -
self を引数で指定した基数の文字列表現に変換します。
...@param base 基数を 2 から 36 の整数で指定します。
12345654321.to_s #=> "12345654321"
12345654321.to_s(2) #=> "1011011111110110111011110000110001"
12345654321.to_s(8) #=> "133766736061"
12345654321.to_s(16) #=> "2dfdbbc31"
78546939656932.to_s(36)......#=> "rubyrules"... -
MatchData
# to _ s -> String (26113.0) -
マッチした文字列全体を返します。
...マッチした文字列全体を返します。
//emlist[例][ruby]{
/bar/ =~ "foobarbaz"
p $~ # => #<MatchData:0x401b1be4>
p $~.to_s # => "bar"
//}... -
Symbol
# to _ s -> String (26101.0) -
シンボルに対応する文字列を返します。
シンボルに対応する文字列を返します。
逆に、文字列に対応するシンボルを得るには
String#intern を使います。
p :foo.id2name # => "foo"
p :foo.id2name.intern == :foo # => true
@see String#intern...シンボルに対応する文字列を返します。
逆に、文字列に対応するシンボルを得るには
String#intern を使います。
p :foo.id2name # => "foo"
p :foo.id2name.intern == :foo # => true
@see String#intern
@see Symbol#name... -
UnboundMethod
# to _ s -> String (26101.0) -
self を読みやすい文字列として返します。
...self を読みやすい文字列として返します。
詳しくは Method#inspect を参照してください。
//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}
@see Method#inspect... -
Fixnum
# to _ s(base = 10) -> String (23237.0) -
self を引数で指定した基数の文字列表現に変換します。
...列表現に変換します。
@param base 基数を 2 から 36 の整数で指定します。
12345.to_s #=> "12345"
12345.to_s(2) #=> "11000000111001"
12345.to_s(8) #=> "30071"
12345.to_s(10) #=> "12345"
12345.to_s(16) #=> "3039"
12345.to_s(36) #=> "9ix"... -
Integer
# to _ s(base=10) -> String (23225.0) -
整数を 10 進文字列表現に変換します。
...現に変換します。
//emlist[][ruby]{
p 10.to_s(2) # => "1010"
p 10.to_s(8) # => "12"
p 10.to_s(16) # => "a"
p 35.to_s(36) # => "z"
//}
@return 数値の文字列表現
@param base 基数となる 2 - 36 の数値。
@raise ArgumentError base に 2 - 36 以外の数値を指定... -
Module
# to _ s -> String (23161.0) -
モジュールやクラスの名前を文字列で返します。
...][ruby]{
module A
module B
end
p B.name #=> "A::B"
class C
end
end
p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"
# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b09112c......8>"
p Class.new.to_s #=> "#<Class:0x00007fa5c40b41b0>"
//}... -
Method
# to _ s -> String (23113.0) -
self を読みやすい文字列として返します。
...下の形式の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です......rb:2」は Method#source_location を表します。
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 Ba......r.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以下の形式になります。
#<Method: klass1#method() foo.rb:2> (形式2)
特異メソッドに対しては、
#<Method: obj.method() foo.rb:2> (形式3)... -
Thread
# to _ s -> String (23113.0) -
自身を人間が読める形式に変換した文字列を返します。
...自身を人間が読める形式に変換した文字列を返します。
//emlist[例][ruby]{
a = Thread.current
a.inspect # => "#<Thread:0x00007fdbaf07ddb0 run>"
b = Thread.new{}
b.inspect # => "#<Thread:0x00007fdbaf8f7d10@(irb):3 dead>"
//}... -
Symbol
. all _ symbols -> [Symbol] (17212.0) -
定義済みの全てのシンボルオブジェクトの配列を返します。
...定義済みの全てのシンボルオブジェクトの配列を返します。
p Symbol.all_symbols #=> [:RUBY_PLATFORM, :RUBY_VERSION, ...]
リテラルで表記したシンボルのうち、コンパイル時に値が決まるものはその時に生成されます。
それ以外の式......)
def number
'make_3'
end
p Symbol.all_symbols.select{|sym|sym.to_s.include? 'make'}
#=> [:make_1, :make_2]
re = #確実に生成されるように代入操作を行う
:make_1,
:'make_2',
:"#{number}",
'make_4'.intern
p Symbol.all_symbols.select{|sym|sym.to_s.include? '...