465件ヒット
[401-465件を表示]
(0.039秒)
別のキーワード
モジュール
- Kernel (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Application (1)
- BasicObject (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - Numeric (11)
- ReFe (11)
- Ruby プログラムの実行 (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- Ruby用語集 (11)
- Singleton (11)
-
WIN32OLE
_ METHOD (11) -
WIN32OLE
_ PARAM (11) -
WIN32OLE
_ VARIABLE (11) - WeakRef (11)
- [] (7)
- call (14)
- cgi (11)
-
cgi
/ session (11) - coverage (7)
- debug (11)
- irb (11)
-
irb
/ completion (11) - match (22)
-
module
_ function (19) - rdoc (11)
-
rdoc
/ parser / ruby (11) -
require
_ relative (11) -
rexml
/ parsers / streamparser (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 9 feature (11) -
undef
_ method (11) -
webrick
/ cgi (11) - xmlrpc (3)
- クラス/メソッドの定義 (11)
- 制御構造 (11)
検索結果
先頭5件
-
Regexp
# match(str , pos = 0) -> MatchData | nil (12.0) -
指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。
...> #<MatchData:0x29403fc>
p reg.match("bar") # => nil
p /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}
=== 便利な使いかた
正規表現にマッチした部分文字列だけが必要な場合に、
//emlist[][ruby]{
bar = /foo(.*)baz/.match("foo......s では、マッチに失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。
//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures
# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}......に失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。
//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures
# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}
@see Regexp#match?... -
Regexp
# match(str , pos = 0) {|m| . . . } -> object | nil (12.0) -
指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。
...> #<MatchData:0x29403fc>
p reg.match("bar") # => nil
p /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}
=== 便利な使いかた
正規表現にマッチした部分文字列だけが必要な場合に、
//emlist[][ruby]{
bar = /foo(.*)baz/.match("foo......s では、マッチに失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。
//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures
# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}......に失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。
//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures
# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}
@see Regexp#match?... -
Singleton (12.0)
-
Singleton パターンを提供するモジュールです。
...インスタンスを返します。
new は private メソッドに移され、外部から呼び出そうとするとエラーになります。
=== サンプルコード
require 'singleton'
class SomeSingletonClass
include Singleton
#....
end
a = SomeSingletonClass.instance......b = SomeSingletonClass.instance # a and b are same object
p [a,b] # => [#<SomeSingletonClass:0x0000562e6e18ddd0>, #<SomeSingletonClass:0x0000562e6e18ddd0>]
a = SomeSingletonClass.new # => NoMethodError (private method `new' called for SomeSingletonClass:Class)... -
WIN32OLE
_ VARIABLE (12.0) -
OLEオートメーションの変数情報をRubyで参照するためのクラスです。
...ためのクラスです。
OLEオートメーションサーバは、定数(WIN32OLE.const_load)、メソッ
ド/プロパティ(WIN32OLE_METHOD)、イベント(WIN32OLE_EVENT)
のほかに変数をクライアントへ提供できます。WIN32OLE_VARIABLEクラスは、サー
バが......として利用で
きます。
WIN32OLE_VARIABLEのオブジェクトは、WIN32OLE_TYPE#variablesメソッ
ドを利用して取得します。
=== サンプルコード
require 'win32ole'
tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
variables = tobj.... -
WeakRef (12.0)
-
weak reference を実現するクラスです。
...あります。
アクセスしようとしたときにオブジェクトが GC されていれば
WeakRef::RefError が発生します。
delegate も参照してください。
=== サンプルコード
require 'weakref'
foo = Object.new
ref = WeakRef.new(foo)
ref.some_method_of_foo... -
rexml
/ parsers / streamparser (12.0) -
ストリーム式の XML パーサ。
...要素を前から順に処理し、
その順にコールバックメソッドを呼び出します。順が前後することはありません。
===[a:example] StreamParserの例
この例では tag_start と text をオーバーライドして
開始タグとテキストの情報を受け取......rt[comment]",
# "text[comment here]",
# "text[\n ]",
# "text[\n ]",
# "tag_start[member]",
# "text[\n]",
# "text[\n]"]
//}
=== コールバック仕様確認サンプル
以下の例では様々なXMLの構成要素を含むXML文書を
StreamParser で処理したとき....../bar"><![CDATA[cdata is here]]>
<a foo:att='1' bar:att='2' att='<'/>
&& <!-- comment here--> &bar;
</root>
EOS
class Listener
def method_missing(name, *args)
p [name, *args]
end
def respond_to_missing?(sym, include_private)
true
end
end
REXML::Parsers::StreamParser.n...