150件ヒット
[101-150件を表示]
(0.066秒)
別のキーワード
クラス
- Exception (24)
-
JSON
:: State (12) - Module (12)
- Object (24)
-
OpenSSL
:: BN (12) - Proc (6)
- StringScanner (48)
- WIN32OLE (12)
キーワード
- == (12)
- === (12)
-
backtrace
_ locations (12) -
check
_ circular? (12) -
check
_ until (12) -
initialize
_ copy (12) -
ole
_ query _ interface (12) -
prime
_ fasttest? (12) -
ruby2
_ keywords (18) -
scan
_ full (12) -
search
_ full (12)
検索結果
先頭5件
-
Object
# initialize _ copy(obj) -> object (143.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...の内部で Object#initialize_clone から、
また Object#dup の内部で Object#initialize_dup から呼ばれます。
initialize_copy は、Ruby インタプリタが知り得ない情報をコピーするた
めに使用(定義)されます。例えば C 言語でクラスを実装する場......に利用しているかを示します。
obj.dup は、新たに生成したオブジェクトに対して
initialize_copy を呼び
//emlist[][ruby]{
obj2 = obj.class.allocate
obj2.initialize_copy(obj)
//}
obj2 に対してさらに obj の汚染状態、インスタンス変数、ファイナ......ruby]{
obj = Object.new
class <<obj
attr_accessor :foo
def bar
:bar
end
end
def check(obj)
puts "instance variables: #{obj.inspect}"
puts "tainted?: #{obj.tainted?}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end
obj.foo = 1
obj.taint
check... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (131.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ん。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace......_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Exception
# ==(other) -> bool (125.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...//emlist[例][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }... -
StringScanner
# scan _ full(regexp , s , f) -> object (119.0) -
スキャンポインタの位置から regexp と文字列のマッチを試します。
...r#scan と同等。
* scan_full(regexp, true, false) は StringScanner#skip と同等。
* scan_full(regexp, false, true) は StringScanner#check と同等。
* scan_full(regexp, false, false) は StringScanner#match? と同等。
@param regexp マッチに用いる正規表現を指定......マッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.scan_full(/\w+/, true, true) #=> "test"
p s.scan_full(/\s+/, false, true) #=> "......"
p s.scan_full(/\s+/, true, false) #=> 1
p s.scan_full(/\w+/, false, false) #=> 6
p s.scan_full(/\w+/, true, true) #=> "string"
//}
@see StringScanner#scan StringScanner#skip StringScanner#check StringScanner#match?... -
StringScanner
# search _ full(regexp , s , f) -> object (119.0) -
regexp で指定された正規表現とマッチするまで文字列をスキャンします。
...同等。
* search_full(regexp, true, false) は StringScanner#skip_until と同等。
* search_full(regexp, false, true) は StringScanner#check_until と同等。
* search_full(regexp, false, false) は StringScanner#exist? と同等。
@param regexp マッチに用いる正規表現......マッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.search_full(/t/, true, true) #=> "t"
p s.search_full(/str/, false, true) #=...