65件ヒット
[1-65件を表示]
(0.045秒)
別のキーワード
種類
- インスタンスメソッド (54)
- 文書 (11)
ライブラリ
- ビルトイン (54)
クラス
- Binding (6)
- Method (21)
- Module (5)
- Proc (11)
- UnboundMethod (11)
キーワード
-
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
const
_ source _ location (5) - inspect (5)
-
to
_ s (5)
検索結果
先頭5件
-
Proc
# source _ location -> [String , Integer] | nil (18232.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 (18226.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 (18220.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] (18208.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] (6280.0) -
name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
...name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義され......C2 = 8 # 定数を再定義する
end
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 Object.const_source_location('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const_source_location('A') # => ["test.rb", 1] -- クラスが再定義された場合は最初の定義位置を返す
p B.const_source_location('A') #... -
Method
# inspect -> String (120.0) -
self を読みやすい文字列として返します。
...ジュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include......ラスメソッド
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 (120.0) -
self を読みやすい文字列として返します。
...ジュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include......ラスメソッド
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... -
NEWS for Ruby 2
. 6 . 0 (66.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* Array#filter! が Array#select! の別名として追加されました。 13784
* Binding
* 新規メソッド
* Binding#source_location 追加 14230
* bindingのソースコード上の位置を __FILE__ と __LINE__ の二要素配列として返します。......ンスを返すようになりました。
* Regexp/String
* Unicode のバージョンを 10.0.0 から 11.0.0 に更新しました。 14802
これは書記素クラスタ (/\X/) アルゴリズムの書き換えと String#downcase での
Georgian MTAVRULI の special-casi......"require(feature)" で読み込むファイルを
特定します。 [実験的] 15230
* String
* String#crypt は非推奨になりました。 14915
* 新機能
* String#split はブロックが渡されていたら部分文字列ごとに呼び出すようになりまし... -
NEWS for Ruby 2
. 7 . 0 (60.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...)
where(sales: ..100)
//}
* 「$;」にnil以外の値を設定すると警告が出るようになりました。 14240
nil以外の時はString#splitで参照した時も警告が出ます。
この警告は「-W:no-deprecated」オプションで止められます。
* 「$,」にn......くる情報が増えました。 14145
* Module
* 新規メソッド
* 定数が定義された場所を取得するModule#const_source_location
メソッドが追加されました。 10771
* 通常の引数分解でキーワード引数を渡すようにメソッドに......同じModuleは常に同じStringを返します。
この変更は実験的です。 16150
* NilClass / TrueClass / FalseClass
* 変更されたメソッド
* NilClass#to_s, TrueClass#to_s, FalseClass#to_sが
常にfreezeされたStringを返すようになりまし...