12件ヒット
[1-12件を表示]
(0.119秒)
ライブラリ
- ビルトイン (5)
- digest (1)
- fiddle (1)
- psych (1)
-
rdoc
/ single _ class (1) -
ripper
/ filter (1) - timeout (1)
キーワード
- BasicObject (1)
- Closure (1)
- ConditionVariable (1)
- Error (1)
- Filter (1)
- Location (1)
- NilClass (1)
- Numeric (1)
- Options (1)
- SingleClass (1)
- Visitors (1)
検索結果
-
Digest
:: Class (63004.0) -
-
NilClass (36004.0)
-
nil のクラス。 nil は NilClass クラスの唯一のインスタンスです。 nil は false オブジェクトとともに偽を表し、 その他の全てのオブジェクトは真です。
...nil のクラス。
nil は NilClass クラスの唯一のインスタンスです。
nil は false オブジェクトとともに偽を表し、
その他の全てのオブジェクトは真です。... -
RDoc
:: SingleClass (36004.0) -
特異クラスを表現するクラスです。
特異クラスを表現するクラスです。
ライブラリの内部で使用します。 -
Numeric (18058.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...d
//}
また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。
//emlist[][ruby]{
class Numeric
def roundup(d=0)
x = 10**d
if self > 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end
def roun... -
Ripper
:: Filter (18058.0) -
イベントドリブンスタイルで Ruby プログラムを加工するためのクラスです。
...e 'ripper'
require 'cgi'
class Ruby2HTML < Ripper::Filter
def on_default(event, tok, f)
f << CGI.escapeHTML(tok)
end
def on_comment(tok, f)
f << %Q[<span class="comment">#{CGI.escapeHTML(tok)}</span>]
end
def on_tstring_beg(tok, f)
f << %Q[<span class="string">#{CGI.escapeHT... -
Psych
:: Visitors (18052.0) -
Psych 内部で利用する各種 Visitor class を保持しているモジュール。
...Psych 内部で利用する各種 Visitor class を保持しているモジュール。... -
BasicObject (18040.0)
-
特殊な用途のために意図的にほとんど何も定義されていないクラスです。 Objectクラスの親にあたります。Ruby 1.9 以降で導入されました。
...クラスから派生すべきです。
真に必要な場合にだけ BasicObject から派生してください。
=== 例
//emlist[例][ruby]{
class Proxy < BasicObject
def initialize(target)
@target = target
end
def method_missing(message, *args)
@target.__send__(message, *args... -
RDoc
:: Options (18022.0) -
rdoc コマンドのオプションを解析するためのクラスです。
...ンは必ず指定
する必要があります。rdoc --help を実行すると追加したオプションの一覧が
確認できます。
例:
class RDoc::Generator::Spellcheck
RDoc::RDoc.add_generator self
def self.setup_options rdoc_options
op = rdoc_options.option_parser... -
Thread
:: Backtrace :: Location (18022.0) -
Ruby のフレームを表すクラスです。
...例1の実行結果:
caller_locations.rb:2:in `a'
caller_locations.rb:5:in `b'
caller_locations.rb:8:in `c'
//emlist[例2][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
p... -
Thread
:: ConditionVariable (18022.0) -
スレッドの同期機構の一つである状態変数を実現するクラスです。
...が空になった場合、
あるいは満タンになった場合に Condition Variable を使って wait しています。
require 'thread'
class TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mut... -
Fiddle
:: Closure (9058.0) -
コールバック関数を表すクラスです。
...でオブジェクトを生成することで利用します。
require 'fiddle'
include Fiddle # TYPE_* を使うために include する
class Compare < Fiddle::Closure
# qsort の比較関数は 型が int(*)(void*, void*) であるため、
# このメソッドには DL::CPtr......p s # => "()07Uabcqx"
Class.new を使うことで、サブクラスを明示的に作ることなしに
コールバックオブジェクトを作ることができます。
require 'fiddle'
include Fiddle # TYPE_* を使うために include する
compare = Class.new(Fiddle::Closure){... -
Timeout
:: Error (9040.0) -
timeout で定義される例外クラスです。 関数 timeout がタイムアウトすると発生します。
...ror のサブクラスを
定義して使用した方が無難です。
==> foo.rb <==
require 'timeout.rb'
class Foo
FooTimeoutError = Class.new(Timeout::Error)
def longlongtime_method
Timeout.timeout(100, FooTimeoutError) {
.....