別のキーワード
種類
- 文書 (50)
- インスタンスメソッド (22)
- ライブラリ (11)
ライブラリ
- ビルトイン (22)
クラス
- Regexp (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - irb (11)
-
ruby 1
. 9 feature (11) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
Regexp
# match(str , pos = 0) -> MatchData | nil (18316.0) -
指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。
...字列 str に対して位置 pos から自身が表す正規表現によるマッ
チングを行います。マッチした場合には結果を MatchData オブジェクトで返し
ます。
マッチしなかった場合 nil を返します。
省略可能な第二引数 pos を指定すると......uby]{
reg = Regexp.new("foo")
if reg.match("foobar")
puts "match"
end
# => match
p reg.match("foobar") # => #<MatchData:0x29403fc>
p reg.match("bar") # => nil
p /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}
=== 便利な使いかた
正規表現......o)(bar)(baz)/.match("foobarbaz")
p [foo, bar, baz]
# => ["foo", "bar", "baz"]
//}
このような用途に MatchData#captures が使
えると考えるかも知れませんが、captures では、マッチに失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発... -
Regexp
# match(str , pos = 0) {|m| . . . } -> object | nil (18216.0) -
指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。
...字列 str に対して位置 pos から自身が表す正規表現によるマッ
チングを行います。マッチした場合には結果を MatchData オブジェクトで返し
ます。
マッチしなかった場合 nil を返します。
省略可能な第二引数 pos を指定すると......uby]{
reg = Regexp.new("foo")
if reg.match("foobar")
puts "match"
end
# => match
p reg.match("foobar") # => #<MatchData:0x29403fc>
p reg.match("bar") # => nil
p /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}
=== 便利な使いかた
正規表現......o)(bar)(baz)/.match("foobarbaz")
p [foo, bar, baz]
# => ["foo", "bar", "baz"]
//}
このような用途に MatchData#captures が使
えると考えるかも知れませんが、captures では、マッチに失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (684.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...ことを意味する
ようになります。((<ruby-dev:20358>))
: defined? [compat]
属性代入、配列要素への代入に対して "method" でなく "assignment" を返
すようになりました。
: ((<リテラル/数値リテラル>)) [compat]
10進((*整数*))リテラル......$! と rescue 節の例外クラスとは ((<Module#===|Module/===>))
を使って比較するようになりました。
以前は kind_of? による比較なので基本的な動作に変わりはありませんが、
SystemCallError.=== は特別に errno が一致する例外を同じと......Enumerable#inject|Enumerable/inject>)) [new]
追加
=== File
: ((<File/File.extname>)) [new]
追加。ファイル名の拡張子を返します。((<ruby-talk:37617>))
: ((<File/File.fnmatch>)) [new]
: ((<File/File.fnmatch?>)) [new]
追加
このメソッドで使用する... -
ruby 1
. 9 feature (570.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...追加
== 1.9.0
=== 2006-09-16
: Struct#inspect
=== 2006-09-14
: digest.rb
: Digest::Base.file
=== 2006-09-13
: Hash#compare_by_identity
: Hash#compare_by_identity?
: Hash#identical
: Hash#identical?
=== 2006-09-12
: Hash#compare_by_identity
: Hash#compare_by_identity?
=== 2006-09-11
: Ha......sh#identical
: Hash#identical?
=== 2006-08-31
: Array#shuffle
: Array#shuffle!
追加
=== 2006-07-26
: __send
: __send!
追加
: invoke_method
: invoke_functional_method
削除
=== 2006-07-21
: Module#attr
オプショナル引数の assignable がなくなり、attr_reader 相当......uby+1.9+update+4>))
=== 2006-05-22
: accept
((<ruby-core:7917>))
=== 2006-03-21
: MatchData#[] [compat]
名前による参照
((<ruby-dev:28446>))
=== 2006-03-03
: FileUtils.cp_r [lib] [compat]
remove_destination オプションの追加
((<ruby-dev:28417>))
=== 2006-02-15
: ins... -
クラス/メソッドの定義 (212.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...義:
* class
* singleton_class
* module
* method
* operator
* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* defined
===[a:class] クラス定義
//emlist[例][ruby]{
class Foo......も同じ)
class Foo
def bar
end
end
# 間違ったスーパークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch for class Foo (TypeError)
//}
クラス定義式の中は self がそのクラスであることと、
limitのデフォルトが異なること......ス定義式は、最後に評価した式の結果を返します。最後に評価した式
が値を返さない場合は nil を返します。
===[a:singleton_class] 特異クラス定義
//emlist[例][ruby]{
obj = Object.new # obj = nil でも可
class << obj
def test
# ...
end
# .... -
NEWS for Ruby 3
. 0 . 0 (168.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...entError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call(......arding (`...`) now supports leading arguments.
16378
//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}
* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]
* `=>` is added. It can be......== Command line options
=== `--help` option
When the environment variable `RUBY_PAGER` or `PAGER` is present and has
a non-empty value, and the standard input and output are tty, the `--help`
option shows the help message via the pager designated by the value.
16754
=== `--backtrace-limit` opti... -
irb (96.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...irb は Interactive Ruby の略です。
irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
=== irb の使い方
Ruby さえ知っていれば irb を使うのは簡単です。
irb コマンドを実行すると、以下のようなプロン......b(main):006:0> irb # サブ irb を起動
irb#1(main):001:0> x # x を表示
NameError: undefined local variable or method `x' for main:Object
from (irb#1):1:in `Kernel#binding'
起動時のインタプリタでローカル変数 x を定義しましたが、
「i......ます。
: help(*names)
: irb_help(*names)
RI から Ruby のドキュメントを参照します。
//emlist{
irb(main):001:0> help String#match
...
//}
names を指定しなかった場合は、RI を対話的なモードで起動します。メソッ
ド名などを入力する事... -
NEWS for Ruby 2
. 2 . 0 (90.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...れた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.1.0 以降の変更
=== 言語仕様の変更
* nil/true/false
* nil/true/false はフリーズされました 8923
* Hash リテラル
* 後ろにコロン......GC可能になりました
* Method
* 追加: Method#curry([arity]) はカリー化された Proc オブジェクトを返します
* 追加: Method#super_method はスーパクラスの同名のメソッドの Method オブジェクトを返します。
=== 組み込みクラスの互......er raised when lambda Proc is passed as a
block, and the number of yielded arguments does not match the formal
arguments of the lambda, if just an array is yielded and its length
matches.
* Process
* Process.spawn のようなプロセスを起動するようなメソッド... -
NEWS for Ruby 3
. 1 . 0 (72.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...148
* MatchData
* 新規メソッド
* MatchData#match が追加されました。 18172
* MatchData#match_length が追加されました。 18172
* Method / UnboundMethod
* 新規メソッド
* Method#public?, Method#private?, Method#protected?, UnboundMethod#public......?, UnboundMethod#private?, UnboundMethod#protected? が追加されました。 11689
* Module
* 変更されたメソッド
* Module#prepend はレシーバが既に引数をincludeしている場合、継承ツリーを変更するようになりました。レシーバが既に引数......t がWindows以外のx86-64プラットフォームでは --yjit に、その他のプラットフォームでは --mjit に変更されました。
=== MJIT
* --mjit-max-cache のデフォルト値が100から10000に変更されました。
* クラスイベントでTracePointが有効にな...