クラス
- Module (5)
-
OpenSSL
:: Cipher (22) - Proc (5)
モジュール
-
CGI
:: HtmlExtension (22) - GC (22)
- ObjectSpace (33)
キーワード
- Cipher (11)
-
cgi
/ session (11) -
define
_ finalizer (22) - html (22)
-
ruby2
_ keywords (10) - stat (22)
-
undefine
_ finalizer (11) - update (11)
- 正規表現 (11)
検索結果
先頭5件
-
OpenSSL
:: Cipher # final -> String (18201.0) -
暗号オブジェクト内部に残されたデータを暗号化/復号化し、文字列で 返します。
暗号オブジェクト内部に残されたデータを暗号化/復号化し、文字列で
返します。
パディング(OpenSSL::Cipher#padding=)を有効にしている場合は、
残されたデータにパディングを付加した上で暗号化します。 -
ObjectSpace
. # define _ finalizer(obj) {|id| . . . } -> Array (6206.0) -
obj が解放されるときに実行されるファイナライザ proc を 登録します。同じオブジェクトについて複数回呼ばれたときは置き換えで はなく追加登録されます。固定値 0 と proc を配列にして返します。
...ID を引数として実行されます。
=== 使い方の注意
以下は、define_finalizer の使い方の悪い例です。
//emlist[悪い例][ruby]{
class Foo
def initialize
ObjectSpace.define_finalizer(self) {
puts "foo"
}
end
end
Foo.new
GC.start
//}
これは、渡さ......e_finalizer(self, Bar.callback)
end
end
Bar.new
GC.start
//}
proc の呼び出しで発生した大域脱出(exitや例外)は無視されます。
これは、スクリプトのメイン処理が GC の発生によって非同期に中断され
るのを防ぐためです。不安なうちは -d......例外の発生の有無を確認しておいた方が良いでしょう。
//emlist[例][ruby]{
class Baz
def initialize
ObjectSpace.define_finalizer self, eval(%q{
proc {
raise "baz" rescue puts $!
raise "baz2"
puts "baz3"
}
}, TOPLEVEL_BINDING)
end... -
ObjectSpace
. # define _ finalizer(obj , proc) -> Array (6206.0) -
obj が解放されるときに実行されるファイナライザ proc を 登録します。同じオブジェクトについて複数回呼ばれたときは置き換えで はなく追加登録されます。固定値 0 と proc を配列にして返します。
...ID を引数として実行されます。
=== 使い方の注意
以下は、define_finalizer の使い方の悪い例です。
//emlist[悪い例][ruby]{
class Foo
def initialize
ObjectSpace.define_finalizer(self) {
puts "foo"
}
end
end
Foo.new
GC.start
//}
これは、渡さ......e_finalizer(self, Bar.callback)
end
end
Bar.new
GC.start
//}
proc の呼び出しで発生した大域脱出(exitや例外)は無視されます。
これは、スクリプトのメイン処理が GC の発生によって非同期に中断され
るのを防ぐためです。不安なうちは -d......例外の発生の有無を確認しておいた方が良いでしょう。
//emlist[例][ruby]{
class Baz
def initialize
ObjectSpace.define_finalizer self, eval(%q{
proc {
raise "baz" rescue puts $!
raise "baz2"
puts "baz3"
}
}, TOPLEVEL_BINDING)
end... -
ObjectSpace
. # undefine _ finalizer(obj) -> object (6200.0) -
obj に対するファイナライザをすべて解除します。 obj を返します。
...finalize"
}
end
def initialize
ObjectSpace.define_finalizer(self, Sample.callback)
end
def undef
ObjectSpace.undefine_finalizer(self)
end
end
Sample.new
GC.start
# => finalize
Sample.new
sample.undef
GC.start
# ※何も出力されない
//}
@see ObjectSpace.#define_final... -
正規表現 (636.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...るよう
になる場合があります。つまりメタ文字列を構成します。例えば
//emlist[][ruby]{
/[a-z]/
/\Axyz\Z/
//}
という正規表現において "[a-z]", "\A", "\Z"はメタ文字列です。
===[a:expansion] 式展開
正規表現内では、#{式} という形式で......タ文字が含まれているならば、それは
メタ文字として認識されます。
//emlist[][ruby]{
number = "(\\d+)"
operator = "(\\+|-|\\*|/)"
/#{number}#{operator}#{number}/.match("43+291")
# => #<MatchData "43+291" 1:"43" 2:"+" 3:"291">
//}
埋め込む文字列をリテラルと......な文字(空白を含む) ([[:graph:]] | Space_Separator)
* [:punct:] 句読点 (Connector_Punctuation | Dash_Punctuation | Close_Punctuation | Final_Punctuation | Initial_Punctuation | Other_Punctuation | Open_Punctuation)
* [:space:] 空白、改行、復帰 (Space_Separator | Line_Separator... -
Module
# ruby2 _ keywords(method _ name , . . . ) -> nil (148.0) -
For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.
...is called
with keyword arguments, the final hash argument is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. I... -
Proc
# ruby2 _ keywords -> proc (148.0) -
Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.
...is called with keyword arguments, the final hash
argument is marked with a special flag such that if it is the final
element of a normal argument splat to another method call, and that
method call does not include explicit keywords or a keyword splat, the
final element is interpreted as keywords.......so, be aware that if this method is removed, the behavior of the
proc will change so that it does not pass through keywords.
//emlist[][ruby]{
module Mod
foo = ->(meth, *args, &block) do
send(:"do_#{meth}", *args, &block)
end
foo.ruby2_keywords if foo.respond_to?(:ruby2_keywords)
end
//}... -
CGI
:: HtmlExtension # html(attributes = {}) -> String (124.0) -
トップレベルの html 要素を生成します。 ブロックを与えると、ブロックを評価した結果が内容になります。
...とができます。
例:
html{ "string" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML>
html({ "LANG" => "ja" }){ "string" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML>
html({ "DOCTYPE" => false }){ "string......ml({ "DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' }){ "string" }
# <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML>
html({ "PRETTY" => " " }){ "<BODY></BODY>" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# <HTML>
# <BODY>
#......</BODY>
# </HTML>
html({ "PRETTY" => "\t" }){ "<BODY></BODY>" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# <HTML>
# <BODY>
# </BODY>
# </HTML>
html("PRETTY"){ "<BODY></BODY>" }
# = html({ "PRETTY" => " " }){ "<BODY></BODY>" }
ht... -
CGI
:: HtmlExtension # html(attributes = {}) { . . . } -> String (124.0) -
トップレベルの html 要素を生成します。 ブロックを与えると、ブロックを評価した結果が内容になります。
...とができます。
例:
html{ "string" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML>
html({ "LANG" => "ja" }){ "string" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML>
html({ "DOCTYPE" => false }){ "string......ml({ "DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' }){ "string" }
# <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML>
html({ "PRETTY" => " " }){ "<BODY></BODY>" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# <HTML>
# <BODY>
#......</BODY>
# </HTML>
html({ "PRETTY" => "\t" }){ "<BODY></BODY>" }
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
# <HTML>
# <BODY>
# </BODY>
# </HTML>
html("PRETTY"){ "<BODY></BODY>" }
# = html({ "PRETTY" => " " }){ "<BODY></BODY>" }
ht... -
GC
. stat(key) -> Numeric (106.0) -
GC 内部の統計情報を Hash で返します。
...{
:count=>2,
:heap_used=>9,
:heap_length=>11,
:heap_increment=>2,
:heap_live_slot=>6836,
:heap_free_slot=>519,
:heap_final_slot=>0,
:heap_swept_slot=>818,
:total_allocated_object=>7674,
:total_freed_object=>838,
:malloc_increase=>181034,
:malloc_lim......length=>24,
:heap_allocatable_pages=>0,
:heap_available_slots=>9783,
:heap_live_slots=>7713,
:heap_free_slots=>2070,
:heap_final_slots=>0,
:heap_marked_slots=>0,
:heap_swept_slots=>0,
:heap_eden_pages=>24,
:heap_tomb_pages=>0,
:total_allocated_pages=... -
GC
. stat(result _ hash = {}) -> {Symbol => Integer} (106.0) -
GC 内部の統計情報を Hash で返します。
...length=>24,
:heap_allocatable_pages=>0,
:heap_available_slots=>9783,
:heap_live_slots=>7713,
:heap_free_slots=>2070,
:heap_final_slots=>0,
:heap_marked_slots=>0,
:heap_swept_slots=>0,
:heap_eden_pages=>24,
:heap_tomb_pages=>0,
:total_allocated_pages=...