159件ヒット
[1-100件を表示]
(0.029秒)
別のキーワード
種類
- 文書 (71)
- インスタンスメソッド (66)
- ライブラリ (11)
- クラス (11)
ライブラリ
- ビルトイン (66)
-
rubygems
/ dependency (11)
クラス
-
Gem
:: Dependency (11) - Object (11)
- Regexp (11)
- String (22)
- Symbol (11)
キーワード
- !~ (11)
- % (11)
- =~ (33)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) - Numeric (11)
- Ruby プログラムの実行 (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- irb (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11)
検索結果
先頭5件
-
Regexp
# ~ -> Integer | nil (18113.0) -
変数 $_ の値との間でのマッチをとります。
...じ意味です。
//emlist[][ruby]{
self =~ $_
//}
//emlist[例][ruby]{
$_ = "hogehoge"
if /foo/
puts "match"
else
puts "no match"
end
# => no match
# ただし、警告がでる。warning: regex literal in condition
reg = Regexp.compile("foo")
if ~ reg
puts "match"
else
puts "no mat... -
Gem
:: Dependency # =~(other) -> bool (6128.0) -
self と other を比較して真偽値を返します。
...
self と other を比較して真偽値を返します。
self の Gem::Dependency#name が正規表現として other とマッチしない場合は偽を返します。
self が other との依存関係を満たしていれば真を返します。満たしていなければ偽を返します。... -
Object
# !~(other) -> bool (6106.0) -
自身が other とマッチしない事を判定します。
...身が other とマッチしない事を判定します。
self#=~(obj) を反転した結果と同じ結果を返します。
@param other 判定するオブジェクトを指定します。
//emlist[例][ruby]{
obj = 'regexp'
p (obj !~ /re/) # => false
obj = nil
p (obj !~ /re/) # => true
//}... -
String
# =~(other) -> Integer | nil (6106.0) -
正規表現 other とのマッチを行います。 マッチが成功すればマッチした位置のインデックスを、そうでなければ nil を返します。
...現でも文字列でもない場合は
other =~ self を行います。
このメソッドが実行されると、組み込み変数 $~, $1, ...
にマッチに関する情報が設定されます。
@param other 正規表現もしくは =~ メソッドを持つオブジェクト
@raise Ty......peError other が文字列の場合に発生します。
//emlist[例][ruby]{
p "string" =~ /str/ # => 0
p "string" =~ /not/ # => nil
p "abcfoo" =~ /foo/ # => 3
//}... -
Symbol
# =~(other) -> Integer | nil (6106.0) -
正規表現 other とのマッチを行います。
...(self.to_s =~ other と同じです。)
@param other 比較対象のシンボルを指定します。
@return マッチが成功すればマッチした位置のインデックスを、そうでなければ nil を返します。
p :foo =~ /foo/ # => 0
p :foobar =~ /bar/ # => 3
p :foo =~....../bar/ # => nil
@see String#=~... -
ruby 1
. 6 feature (96.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...正しく埋め込めるようにするためです。
((<ruby-bugs-ja:PR#231>))
p Regexp.quote("#")
p /a#{Regexp.quote("#")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"#"
0......になりました。
: 2002-04-26: Regexp.quote
((<ruby-bugs-ja:PR#231>))
p Regexp.quote("\t")
p /a#{Regexp.quote("\t")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"\t"
0......の戻り値
以下のメソッドの戻り値が正しくなりました。((<ruby-bugs-ja:PR#205>))
* ((<Enumerable/each_with_index>)) が self を返すようになった(以前は nil)
* ((<Process/Process.setpgrp>)) が返す値が不定だった。
* ((<String/ljust>)), ((<String/rju... -
Ruby プログラムの実行 (72.0)
-
Ruby プログラムの実行 === Ruby プログラム
...il です。
==== until
==== if 修飾子
==== unless 修飾子
==== while
==== until
==== while 修飾子
==== until 修飾子
==== for
==== begin 〜 end
==== クラス定義式
クラスを定義します。
評価は(コンパイル時ではなく)実行時に行われます。
書式
cla......代入されている場合は例外 TypeError が発生します。
最後に新しいフレームを生成し、トップレベルブロックの self および class
に定義を行おうとするクラスを設定して、そのフレーム上で定義式中の式を評
価します。クラス......れていた場合は例外 TypeError が発生します。
最後に、新しいフレームを生成し、そのトップレベルブロックの self および
class にモジュール ModuleName を設定し、そのフレーム上で定義式中の式を
評価します。モジュール定義... -
Numeric (60.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...- o - -
| | - - o o - - -
~ | - - o o - - -
=== 丸めメソッドの動作一覧
Numeric#ceil, Numeric#......**d
if self > 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end
def rounddown(d=0)
x = 10**d
if self < 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end
def roundoff(d=0)
x = 10**d
if self < 0
(self.quo(x) -......0.5).ceil * x
else
(self.quo(x) + 0.5).floor * x
end
end
end
//}......zero? | o - o - -
| | - o - - -
~ | - o - - -
=== 丸めメソッドの動作一覧
Numeric#ceil, Numeric#floor, Numeric#round,... -
irb (60.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...の機能が使えるようになります。
=== irb のコマンドラインオプション
irb [options] file_name opts
options:
-f ~/.irbrc を読み込まない
-m bc モード (分数と行列の計算ができる)
-d $DEBUG を true に......オブジェクトの作成方法を 0 から 3 で設定する。
(IRB::Context 参照)
--single-irb irb 中で self を実行して得られるオブジェクトをサブ irb と共
有する
--irb_debug n irb のデバッグレベル......りです。
: %N
起動しているコマンド名(IRB::Context#irb_name)
: %m
main オブジェクト (self) を to_s した文字列
: %M
main オブジェクト (self) を inspect した文字列
: %l
文字列中のタイプを表す (", ', /, ], `]'は%wの中の時)
: %NNi......の機能が使えるようになります。
=== irb のコマンドラインオプション
irb [options] file_name opts
options:
-f ~/.irbrc を読み込まない
-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[le... -
Marshal フォーマット (36.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...2
//emlist{
| len | n_1 | n_2 | n_3 | n_4 |
<-1-> <- len ->
byte bytes
//}
len の値は -4 〜 -1, 1 〜 4 で。符号と後続のデータが n1 〜 n_len
まであることを示します。
//emlist[][ruby]{
def foo(len, n1, n2 = 0, n3 = 0, n4 = 0)
case len......ス名(Symbol)の dump | _dump の結果の長さ(Fixnum形式) | _dump が返す値 |
//}
//emlist[][ruby]{
# coding: ascii-8bit
class Foo
def self._load
end
def _dump(obj)
"hogehoge"
end
end
p Marshal.dump(Foo.new).unpack("x2 a aca3 c a*")
# => ["u", ":", 8, "Foo", 13, "hogehoge"]
//}......い][ruby]{
module Baz
@@baz = 1
def self.baz
@@baz
end
end
p Baz.baz
# => 1
File.open('testfile', 'wb') do |f|
Marshal.dump(Baz, f)
end
# 別プログラム相当にするため remove_const
Object.send :remove_const, :Baz
module Baz
def self.baz
@@baz
end
end
p baz = Marshal....