ライブラリ
- ビルトイン (4)
- coverage (1)
- mkmf (4)
- prime (5)
-
rdoc
/ context (1) - timeout (2)
-
webrick
/ httpauth / authenticator (1) - win32ole (1)
クラス
- Coverage (1)
- Object (4)
- Prime (4)
-
Prime
:: EratosthenesGenerator (1) -
RDoc
:: Context (1) - WIN32OLE (1)
モジュール
- Kernel (4)
- Timeout (2)
-
WEBrick
:: HTTPAuth :: Authenticator (1)
キーワード
- ARGV (1)
- AuthScheme (1)
-
NEWS for Ruby 2
. 5 . 0 (1) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (1)
-
check
_ signedness (2) -
convertible
_ int (2) - coverage (1)
- each (4)
-
find
_ symbol (1) - rewind (1)
- start (1)
- timeout (2)
-
yield
_ self (2) - クラス/メソッドの定義 (1)
- プログラム・文・式 (1)
- 制御構造 (1)
- 字句構造 (1)
- 演算子式 (1)
検索結果
先頭5件
-
Object
# then -> Enumerator (54343.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
self を引数としてブロックを評価し、ブロックの結果を返します。
//emlist[例][ruby]{
3.next.then {|x| x**x }.to_s # => "256"
"my string".yield_self {|s| s.upcase } # => "MY STRING"
//}
値をメソッドチェインのパイプラインに次々と渡すのは良い使い方です。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
... -
Object
# then {|x| . . . } -> object (54343.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
self を引数としてブロックを評価し、ブロックの結果を返します。
//emlist[例][ruby]{
3.next.then {|x| x**x }.to_s # => "256"
"my string".yield_self {|s| s.upcase } # => "MY STRING"
//}
値をメソッドチェインのパイプラインに次々と渡すのは良い使い方です。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
... -
Prime
:: EratosthenesGenerator # rewind -> nil (9304.0) -
列挙状態を巻き戻します。
列挙状態を巻き戻します。
//emlist[例][ruby]{
require 'prime'
generator = Prime::EratosthenesGenerator.new
p generator.next #=> 2
p generator.next #=> 3
p generator.next #=> 5
generator.rewind
p generator.next #=> 2
//} -
WEBrick
:: HTTPAuth :: Authenticator :: AuthScheme -> nil (9304.0) -
認証方法を表わします。派生クラスで上書きしなければなりません。
認証方法を表わします。派生クラスで上書きしなければなりません。 -
Object
# yield _ self -> Enumerator (9043.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
self を引数としてブロックを評価し、ブロックの結果を返します。
//emlist[例][ruby]{
3.next.then {|x| x**x }.to_s # => "256"
"my string".yield_self {|s| s.upcase } # => "MY STRING"
//}
値をメソッドチェインのパイプラインに次々と渡すのは良い使い方です。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
... -
Object
# yield _ self {|x| . . . } -> object (9043.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
self を引数としてブロックを評価し、ブロックの結果を返します。
//emlist[例][ruby]{
3.next.then {|x| x**x }.to_s # => "256"
"my string".yield_self {|s| s.upcase } # => "MY STRING"
//}
値をメソッドチェインのパイプラインに次々と渡すのは良い使い方です。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
... -
Kernel
# check _ signedness(type , headers = nil , opts = nil) -> "signed" | "unsigned" | nil (967.0) -
Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.
Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.
If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS... -
Kernel
# check _ signedness(type , headers = nil , opts = nil) { . . . } -> "signed" | "unsigned" | nil (967.0) -
Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.
Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.
If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) (661.0) -
Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG
Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.
If the +type+ is a integer type and _convertible_ type is found,
following macros are p... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) { . . . } (661.0) -
Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG
Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.
If the +type+ is a integer type and _convertible_ type is found,
following macros are p... -
Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) -> Enumerator (625.0) -
全ての素数を順番に与えられたブロックに渡して評価します。
全ての素数を順番に与えられたブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のインスタンスを指定します。
@return ブロックの最後に評価された値を返します。
ブロックが与えられなかった場合は、Enumerator と互換性のある外部イテレータを返します。
//emlist[例][ruby]{
require 'prime'
Prime.each(6){|prime| ... -
Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) {|prime| . . . } -> object (625.0) -
全ての素数を順番に与えられたブロックに渡して評価します。
全ての素数を順番に与えられたブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のインスタンスを指定します。
@return ブロックの最後に評価された値を返します。
ブロックが与えられなかった場合は、Enumerator と互換性のある外部イテレータを返します。
//emlist[例][ruby]{
require 'prime'
Prime.each(6){|prime| ... -
Prime
. each(upper _ bound = nil , generator = EratosthenesGenerator . new) -> Enumerator (625.0) -
Prime.instance.each と同じです。
Prime.instance.each と同じです。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のインスタンスを指定します。
@return ブロックの最後に評価された値を返します。
ブロックが与えられなかった場合は、Enumerator と互換性のある外部イテレータを返します。
@see Prime#each -
Prime
. each(upper _ bound = nil , generator = EratosthenesGenerator . new) {|prime| . . . } -> object (625.0) -
Prime.instance.each と同じです。
Prime.instance.each と同じです。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のインスタンスを指定します。
@return ブロックの最後に評価された値を返します。
ブロックが与えられなかった場合は、Enumerator と互換性のある外部イテレータを返します。
@see Prime#each -
制御構造 (559.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
制御構造
条件分岐:
* if
* unless
* case
繰り返し:
* while
* until
* for
* break
* next
* redo
* retry
例外処理:
* raise
* begin
その他:
* return
* BEGIN
* END
Rubyでは(Cなどとは異なり)制御構造は式であって、何らかの値を返すものが
あります(返さないものもあります。値を返さない式を代入式の右辺に置くと
syntax error になります)。
R... -
クラス/メソッドの定義 (415.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 < S... -
RDoc
:: Context # find _ symbol(symbol , method=nil) (400.0) -
Look up the given symbol. If method is non-nil, then we assume the symbol references a module that contains that method
Look up the given symbol. If method is non-nil, then we assume
the symbol references a module that contains that method -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (394.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
ブロックを sec 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なしで
ブロックを実行します。
@param sec タイムアウトする時間を秒数で指定します.
@param exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラー... -
Coverage
. start(option = {}) -> nil (376.0) -
カバレッジの測定を開始します。既に実行されていた場合には何も起こりません。 ただし、カバレッジ計測中に測定対象を変更しようとした場合は、RuntimeError となります。
カバレッジの測定を開始します。既に実行されていた場合には何も起こりません。
ただし、カバレッジ計測中に測定対象を変更しようとした場合は、RuntimeError となります。
@param option カバレッジの計測モードを指定します。
:all か "all" を指定すると、全ての種類を計測します。
個別に指定する場合は、ハッシュを渡します。
詳細は、coverage ライブラリ を参照してください。
//emlist[bool.rb][ruby]{
def bool(obj)
if obj
... -
coverage (271.0)
-
カバレッジを測定するためのライブラリです。
カバレッジを測定するためのライブラリです。
=== 基本的な使い方
以下のようにして測定を行います。
(1) require "coverage" で、ライブラリを読み込む。
(2) Coverage.start を実行し、測定を開始する。
(3) require や load で測定対象のファイルを実行する。
(4) Coverage.result や Coverage.peek_result で結果を確認する。
Coverage.result は、ファイル名をキーとし、カバレッジ測定結果を値とするハッシュを返します。
==== 簡単な例
まず測定対象のソースを用... -
演算子式 (217.0)
-
演算子式 * assign * selfassign * multiassign * range * range_cond * and * or * not * cond
...る舞います。
フリップフロップ (flip-flop) とも呼ばれます。
この振る舞いは 2.6.0 で deprecated になりましたが、元に戻りました。
そのため、2.6.0 から 2.6.3 では使うと「warning: flip-flop is deprecated」という警告がでます。
「..... -
NEWS for Ruby 2
. 5 . 0 (181.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
NEWS for Ruby 2.5.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.4.0 以降の変更
=== 言語仕様の変更
* トップレベルの定数参照を削除しました 11547
* do/end ブロック内部で rescue/else/ensure を書けるようになりました 12906
* 文字列の式展... -
Timeout
. # timeout(sec , exception _ class , message) {|i| . . . } -> object (94.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
ブロックを sec 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なしで
ブロックを実行します。
@param sec タイムアウトする時間を秒数で指定します.
@param exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラー... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (55.0)
-
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or plus minus ast slash hat sq period comma langl rangl eq tilde dollar at under lbrarbra lbra2rbra2 lbra3rbra3 dq colon ac backslash semicolon
Rubyで使われる記号の意味(正規表現の複雑な記号は除く)
ex q num per and or
plus minus ast slash hat sq
period comma langl rangl eq tilde
dollar at under lbrarbra
lbra2rbra2 lbra3rbra3 dq colon ac
backslash semicolon
===[a:ex] !
: !true
not 演算子。d:spec/operator#notを参照。
: 3 != 5
「等しくない」比較演算子。d:spec/operator#notを参... -
WIN32OLE
:: ARGV -> [object] (55.0) -
直前のメソッド呼び出しの引数を格納した配列です。
直前のメソッド呼び出しの引数を格納した配列です。
OLEオートメーションでは呼び出し先が引数に対して値を設定できます。しかし、
Rubyのメソッド引数は値のみを取るため、そのままでは呼び出し先が設定した
値を参照できません。このような場合、ARGVを参照することで呼び出し先の設
定値を参照できます。
以下のリストは、VBで開発したオブジェクトのメソッド呼び出しを例としてい
ます。このメソッド(Accm)は、第1引数で指定した演算を第2引数と第3引数に
適用し、結果を第2引数に設定します。
' VB (OLE Automation server)
Public Sub Accm(... -
プログラム・文・式 (37.0)
-
プログラム・文・式 * exp * terminate
プログラム・文・式
* exp
* terminate
プログラムはexpを並べたものです。式と式の間はセミコロ
ン(;)または改行で区切ります。ただし、バックスラッシュに続く改行は文
の区切りにならず、次の行へ継続します。
例:
print "hello world!\n"
===[a:exp] 式
例:
true
(1+2)*3
foo()
if test then ok else ng end
Ruby の式には、spec/variables、さまざまなspec/literal... -
字句構造 (37.0)
-
字句構造 * identifier * comment * embed * reserved
字句構造
* identifier
* comment
* embed
* reserved
Rubyの現在の実装はASCIIキャラクタセットを用いています。アル
ファベットの大文字と小文字は区別されます。識別子と一部のリテ
ラルの途中を除いては任意の場所に空白文字やコメントを置くこと
ができます。空白文字とはスペース、タブ、垂直タブ、バックスペー
ス、キャリッジリターン、ラインフィード、改ページです。改行は行が明らかに次の
行に継続する時だけ、空白文字として、それ以外では文の区切りと
して解釈されます。
改行と認識されるのは、キャリッジリターン+ラインフィードかラインフ...