72件ヒット
[1-72件を表示]
(0.036秒)
ライブラリ
- ビルトイン (24)
-
fiddle
/ import (12) -
rdoc
/ context (12) -
rubygems
/ version (12) -
webrick
/ httpversion (12)
クラス
-
Gem
:: Version (12) - Numeric (12)
-
RDoc
:: Context (12) - Rational (12)
-
WEBrick
:: HTTPVersion (12)
モジュール
-
Fiddle
:: Importer (12)
検索結果
先頭5件
-
Rational
# <=>(other) -> -1 | 0 | 1 | nil (21137.0) -
self と other を比較して、self が大きい時に 1、等しい時に 0、小さい時に -1 を返します。比較できない場合はnilを返します。
...ます。
//emlist[例][ruby]{
Rational(2, 3) <=> Rational(2, 3) # => 0
Rational(5) <=> 5 # => 0
Rational(2, 3) <=> Rational(1,3) # => 1
Rational(1, 3) <=> 1 # => -1
Rational(1, 3) <=> 0.3 # => 1
Rational(1, 3) <=> nil # => nil
//}... -
Gem
:: Version # <=>(other) -> -1 | 0 | 1 | nil (21125.0) -
self と other を比較して、self が小さい時に -1、 等しい時に 0、大きい時に 1 の整数を返します。 また、other が Gem::Version ではなく比較できないとき、 nil を返します。
...er が Gem::Version ではなく比較できないとき、 nil を返します。
//emlist[][ruby]{
p Gem::Version.new("3.9.0") <=> Gem::Version.new("3.10.0") # => -1
p Gem::Version.new("3.0.0") <=> Gem::Version.new("3.0.0") # => 0
p Gem::Version.new("3.0.0") <=> Gem::Version.new("3.0") #......=> 0
p Gem::Version.new("3.9.0") <=> "3.9.0" # => nil
//}
@param other 比較対象の Gem::Version のインスタンスを指定します。... -
RDoc
:: Context # <=>(other) -> -1 | 0 | 1 (21101.0) -
自身と other の full_name を比較した結果を返します。
自身と other の full_name を比較した結果を返します。
ソートのために使われます。
@param other 自身と比較したいオブジェクトを指定します。 -
WEBrick
:: HTTPVersion # <=>(other) -> -1 | 0 | 1 | nil (21101.0) -
自身と指定された other のバージョンを比較します。 自身が other より新しいなら 1、同じなら 0、古いなら -1 を返します。 比較できない場合に nil を返します。
...を返します。
比較できない場合に nil を返します。
@param other HTTP のバージョンを表す WEBrick::HTTPVersion オブジェクトか文字列を指定します。
require 'webrick'
v = WEBrick::HTTPVersion.new('1.1')
p v < '1.0' #=> false... -
Numeric
# nonzero? -> self | nil (6113.0) -
自身がゼロの時 nil を返し、非ゼロの時 self を返します。
...の時 nil を返し、非ゼロの時 self を返します。
//emlist[例][ruby]{
p 10.nonzero? #=> 10
p 0.nonzero? #=> nil
p 0.0.nonzero? #=> nil
p Rational(0, 2).nonzero? #=> nil
//}
非ゼロの時に self を返すため、自身が 0 の時に他の......理をさせたい場合に以
下のように記述する事もできます。
//emlist[例][ruby]{
a = %w( z Bb bB bb BB a aA Aa AA A )
b = a.sort {|a,b| (a.downcase <=> b.downcase).nonzero? || a <=> b }
b #=> ["A", "a", "AA", "Aa", "aA", "BB", "Bb", "bB", "bb", "z"]
//}
@see Numeric#zero?... -
Fiddle
:: Importer # bind(signature , *opts) { . . . } -> Fiddle :: Function (107.0) -
Ruby のブロックを C の関数で wrap し、その関数をモジュールに インポートします。
...。
これでインポートされた関数はモジュール関数として定義されます。
また、Fiddle::Importer#[] で Fiddle::Function オブジェクトとして
取り出すことができます。
signature で関数の名前とシネグチャを指定します。例えば
"int co......を表す Fiddle::Function オブジェクトを返します。
@param signature 関数の名前とシネグチャ
@param opts オプション
例
require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "libc.so.6"
typealias "size_t", "unsigned long"
extern "int qsor......"int compare(void*, void*)"){|px, py|
x = px.to_s(Fiddle::SIZEOF_INT).unpack("i!")
y = py.to_s(Fiddle::SIZEOF_INT).unpack("i!")
x <=> y
}
end
data = [32, 180001, -13, -1, 0, 49].pack("i!*")
M.qsort(Fiddle::Pointer[data], 6, Fiddle::SIZEOF_INT, M["compare"])
p data.u...