109件ヒット
[1-100件を表示]
(0.097秒)
種類
- インスタンスメソッド (76)
- 特異メソッド (33)
クラス
- Binding (6)
-
Encoding
:: Converter (44) - Method (21)
- Module (5)
- Proc (11)
- Regexp (11)
- UnboundMethod (11)
キーワード
-
const
_ source _ location (5) - convert (11)
- inspect (5)
- new (33)
-
source
_ location (39) -
to
_ s (5)
検索結果
先頭5件
-
Regexp
# source -> String (26210.0) -
その正規表現のもととなった文字列表現を生成して返します。
...その正規表現のもととなった文字列表現を生成して返します。
//emlist[例][ruby]{
re = /foo|bar|baz/i
p re.source # => "foo|bar|baz"
//}... -
Module
# const _ source _ location(name , inherited = true) -> [String , Integer] (14282.0) -
name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
...name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義され......_source_location('C4') # => ["test.rb", 12]
p B.const_source_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]
p B.const_source_location('C3', false) # => nil -- include したモジュールは検索しない
p A.const_source_......す
p Object.const_source_location('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const_source_location('A') # => ["test.rb", 1] -- クラスが再定義された場合は最初の定義位置を返す
p B.const_source_location('A')... -
Proc
# source _ location -> [String , Integer] | nil (14234.0) -
ソースコードのファイル名と行番号を配列で返します。
...by]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/to/target.rb", 2]
(eval "proc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location # => nil
//}
@see Method#source_location... -
UnboundMethod
# source _ location -> [String , Integer] | nil (14228.0) -
ソースコードのファイル名と行番号を配列で返します。
...nil を返します。
//emlist[例][ruby]{
require 'time'
Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}
@see Proc#source_location, Method#source_location... -
Method
# source _ location -> [String , Integer] | nil (14222.0) -
ソースコードのファイル名と行番号を配列で返します。
...す。
@see Proc#source_location
//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----
require '/tmp/foo'
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]
method(:puts).source_location # => nil... -
Binding
# source _ location -> [String , Integer] (14210.0) -
self の Ruby のソースファイル名と行番号を返します。
...self の Ruby のソースファイル名と行番号を返します。
d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。
//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}... -
Encoding
:: Converter # convert(source _ string) -> String (8317.0) -
与えられた文字列を変換して、変換できた結果を返します。 引数の末尾の文字がバイト列の途中で終わっている場合、そのバイト列は変換器内に取り置かれます。 変換を終了させるには Encoding::Converter#finish を呼びます。
...ケープしたい場合やさらに細かい指定を行いたい場合は、Encoding::Converter#primitive_convert を用います。
@param source_string 変換する文字列の一部または全部です。
@return 変換結果である文字列の一部または全部です。
@raise Encoding:... -
Method
# inspect -> String (8122.0) -
self を読みやすい文字列として返します。
.../モジュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
in......ラスメソッド
class Bar < 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... -
Method
# to _ s -> String (8122.0) -
self を読みやすい文字列として返します。
.../モジュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
in......ラスメソッド
class Bar < 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... -
Encoding
:: Converter . new(source _ encoding , destination _ encoding) -> Encoding :: Converter (8116.0) -
Encoding::Converter オブジェクトを作成します。
...作成します。
@param source_encoding 変換元のエンコーディング
@param destination_encoding 変換先のエンコーディング
@param options 変換の詳細を指定する定数やハッシュ
@param convpath 変換経路の配列
options では String#encode でのハッシュ... -
Encoding
:: Converter . new(source _ encoding , destination _ encoding , options) -> Encoding :: Converter (8116.0) -
Encoding::Converter オブジェクトを作成します。
...作成します。
@param source_encoding 変換元のエンコーディング
@param destination_encoding 変換先のエンコーディング
@param options 変換の詳細を指定する定数やハッシュ
@param convpath 変換経路の配列
options では String#encode でのハッシュ... -
Encoding
:: Converter . new(convpath) -> Encoding :: Converter (8016.0) -
Encoding::Converter オブジェクトを作成します。
...作成します。
@param source_encoding 変換元のエンコーディング
@param destination_encoding 変換先のエンコーディング
@param options 変換の詳細を指定する定数やハッシュ
@param convpath 変換経路の配列
options では String#encode でのハッシュ...