44件ヒット
[1-44件を表示]
(0.022秒)
種類
- 文書 (33)
- インスタンスメソッド (11)
ライブラリ
- ビルトイン (11)
クラス
- Module (11)
キーワード
-
ruby 1
. 6 feature (11) - 制御構造 (11)
- 演算子式 (11)
検索結果
-
Module
# >=(other) -> bool | nil (39160.0) -
比較演算子。self が other の先祖か同一クラスである場合、 true を返します。 self が other の子孫である場合、false を返します。
...。
@see Module#<
//emlist[例][ruby]{
module Foo; end
module Bar
include Foo
end
module Baz
prepend Foo
end
Bar.ancestors # => [Bar, Foo]
Foo >= Bar # => true
Bar >= Foo # => false
Baz.ancestors # => [Foo, Baz]
Foo >= Baz # => true
Baz >= Foo # => false
Foo >= Foo # => true
Foo >= Object #... -
ruby 1
. 6 feature (156.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...uous first argument; make sure
ruby 1.6.7 (2002-07-30) [i586-linux]
"\\#"
nil
: 2002-04-29: rb_find_file()
$SAFE >= 4 で、絶対パス指定でない場合、SecurityError 例外が発生する
ようになりました。
: 2002-04-26: Regexp.quote
((<rub......01) [i586-linux]
""
=> ruby 1.6.7 (2002-03-29) [i586-linux]
"ruby-1.6\000-v\000-"
: 2002-03-22 ((<Module/module_eval>))
((<Module/module_eval>)) のブロック内で定数やクラス変数のスコープが
変わることはなくなりました。((<ruby-dev:......linux]
#<MatchData:0x401b1be4>
#<MatchData:0x401b198c>
#<MatchData:0x401b1644>
#<MatchData:0x401b1414>
=> ruby 1.6.7 (2002-03-19) [i586-linux]
nil
nil
nil
nil
: 2002-03-14 拡張ライブラリの autolo... -
演算子式 (18.0)
-
演算子式 * assign * selfassign * multiassign * range * range_cond * and * or * not * cond
...項)
* / %
+ -
<< >>
&
| ^
> >= < <=
<=> == === != =~ !~
&&
||
.. ...
?:(条件演算子)......)
+@, -@ は単項演算子 +, - を表しメソッド定義
などではこの記法を利用します。
//emlist{
| ^ & <=> == === =~ > >= < <= << >>
+ - * / % ** ~ +@ -@ [] []= ` ! != !~
//}
これらの演算子式の定義方法についてはd:s......oo
end
def foo=( v )
@foo = v
end
end
c = C.new
c.foo = 5 # c.foo=( 5 ) のように変換される
p c.foo # => 5
//}
属性は Module#attr を使って同じように定義できます。
//emlist[例][ruby]{
class C
attr :foo, true
end
c = C.new
c.foo = 5 # c.foo=( 5 ) の... -
制御構造 (12.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...めとする制御構造をクラス設計者が定義する事が出来るものです.
=== 条件分岐
====[a:if] if
//emlist[例][ruby]{
if age >= 12 then
print "adult fee\n"
else
print "child fee\n"
end
gender = if foo.gender == "male" then "male" else "female" end
//}
文法:......文が存在しなかったときの値
はnilです。いずれにしてもensure節の値は無視されます。
d:spec/def#class、d:spec/def#module、d:spec/def#method
などの定義文では、それぞれ
begin なしで rescue, ensure 節を定義でき、これにより例外を処理す...