るりまサーチ

最速Rubyリファレンスマニュアル検索!
65件ヒット [1-65件を表示] (0.188秒)
トップページ > クエリ:-[x] > クエリ:E[x] > クエリ:source_location[x]

別のキーワード

  1. open3 popen2e
  2. socket af_e164
  3. open3 capture2e
  4. matrix rank_e
  5. matrix det_e

ライブラリ

クラス

検索結果

Proc#source_location -> [String, Integer] | nil (24331.0)

ソースコードのファイル名と行番号を配列で返します。

...//emlist[例][ruby]{
# /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 (24325.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 (24319.0)

ソースコードのファイル名と行番号を配列で返します。

...す。

@see Proc#source_location

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
e
nd
# ----- 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] (24307.0)

self の Ruby のソースファイル名と行番号を返します。

...self の Ruby のソースファイル名と行番号を返します。

d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。

//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}...

Module#const_source_location(name, inherited = true) -> [String, Integer] (12367.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義され...
...す。

//emlist[例][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
e
nd

module M # line 6
C3 = 3
e
nd

class B < A # line 10
include M
C4 = 4
e
nd

class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
e
nd

p B.const_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_location('C2') # => ["test....

絞り込み条件を変える

NEWS for Ruby 2.7.0 (6426.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.7.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...トは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。

== 2.6.0 以降の変更

=== 言語仕様の変更

==== パターンマッチ

* パターンマッチが実験的機能として導入されました。 14912

//emlist[][ruby]{
case [0, [1, 2, 3]]
in...
......6] #=> 0b0011
# ^^^^
//}

* Method
* 変更されたメソッド
* Method#inspectで出てくる情報が増えました。 14145

* Module
* 新規メソッド
* 定数が定義された場所を取得するModule#const_source_location
メソッドが追加さ...

Method#inspect -> String (6212.0)

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

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

以下の形式の文字列を返します。

#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクト...
...
method は、メソッド名を表します。

arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location
が nil の場合には付きません。

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

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}

klass1 と klass2 が同じ場合は以下の形式になります。
#<Method: klass1#method() foo.rb:2> (形式2)

特異...

NEWS for Ruby 2.6.0 (6078.0)

NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.6.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...geLog ファイルか bugs.ruby-lang.org の issue を参照してください。

== 2.5.0 以降の変更

=== 言語仕様の変更

* $SAFE はプロセスグローバルで扱われることになると共に、0以外を設定した後に0に戻せるようになりました。 14250

* Re...
...15143
* 別名
* Array#filter が Array#select の別名として追加されました。 13784
* Array#filter! が Array#select! の別名として追加されました。 13784

* Binding
* 新規メソッド
* Binding#source_location 追加 14230
* bindingの...

Method#to_s -> String (3112.0)

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

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

以下の形式の文字列を返します。

#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクト...
...
method は、メソッド名を表します。

arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location
が nil の場合には付きません。

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

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}

klass1 と klass2 が同じ場合は以下の形式になります。
#<Method: klass1#method() foo.rb:2> (形式2)

特異...