133件ヒット
[1-100件を表示]
(0.127秒)
ライブラリ
- ビルトイン (53)
- digest (11)
- fiddle (11)
- logger (1)
- psych (11)
-
rdoc
/ single _ class (11) -
ripper
/ filter (11) - thread (2)
- timeout (11)
キーワード
- Application (1)
- BasicObject (11)
- Closure (11)
- ConditionVariable (11)
- Error (11)
- Filter (11)
- Location (11)
- NilClass (11)
- Numeric (11)
- Options (11)
- SingleClass (11)
- Visitors (11)
検索結果
-
Digest
:: Class (21001.0) -
-
NilClass (12001.0)
-
nil のクラス。 nil は NilClass クラスの唯一のインスタンスです。 nil は false オブジェクトとともに偽を表し、 その他の全てのオブジェクトは真です。
...nil のクラス。
nil は NilClass クラスの唯一のインスタンスです。
nil は false オブジェクトとともに偽を表し、
その他の全てのオブジェクトは真です。... -
RDoc
:: SingleClass (12001.0) -
特異クラスを表現するクラスです。
特異クラスを表現するクラスです。
ライブラリの内部で使用します。 -
Numeric (6019.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッド......はceil, floor を使用して以下のように定義できます。
//emlist[例][ruby]{
if n > 0 then
n.ceil
else
n.floor
end
//}
また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。
//emlist[][ruby]{
class Numeric
def......d=0)
x = 10**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... -
Ripper
:: Filter (6019.0) -
イベントドリブンスタイルで Ruby プログラムを加工するためのクラスです。
...emlist[][ruby]{
require '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.escapeHTML(tok)}]
end
def on_tstring_end(tok, f)
f << %Q[#{CGI.escapeHTML(tok)}</span>]
end
end
Ruby2HTML.new(ARGF).parse('')
//}
Ruby プログラムを解析して、Ripper::SCANNER_EVENTS にあるスキャナ
イベントを実行します。イベントはプログラ... -
Psych
:: Visitors (6017.0) -
Psych 内部で利用する各種 Visitor class を保持しているモジュール。
...Psych 内部で利用する各種 Visitor class を保持しているモジュール。... -
BasicObject (6013.0)
-
特殊な用途のために意図的にほとんど何も定義されていないクラスです。 Objectクラスの親にあたります。Ruby 1.9 以降で導入されました。
...=== 性質
BasicObject クラスは Object クラスからほとんどのメソッドを取り除いたクラスです。
Object クラスは様々な便利なメソッドや Kernel から受け継いだ関数的メソッド
を多数有しています。
これに対して、 BasicObject クラ......asicObject から派生
して問題を解決できます。
=== 注意
通常のクラスは Object またはその他の適切なクラスから派生すべきです。
真に必要な場合にだけ BasicObject から派生してください。
=== 例
//emlist[例][ruby]{
class Proxy < BasicO......bject
def initialize(target)
@target = target
end
def method_missing(message, *args)
@target.__send__(message, *args)
end
end
proxy = Proxy.new("1")
proxy.to_i #=> 1
//}... -
Logger
:: Application (6007.0) -
ユーザ定義のアプリケーションにログ機能を簡単に追加することができます。
...start メソッドを呼び出します。
例:
class FooApp < Application
def initialize(foo_app, application_specific, arguments)
super('FooApp') # Name of the application.
end
def run
...
log(WARN, 'warning', 'my_method1')
...
@log.error('my_meth......od2') { 'Error!' }
...
end
end
status = FooApp.new(....).start
=== 注意
このクラスは 2.2.0 で gem ライブラリとして切り離されました。2.2.0
以降ではそちらを利用してください。
* https://rubygems.org/gems/logger-application... -
RDoc
:: Options (6007.0) -
rdoc コマンドのオプションを解析するためのクラスです。
...クラスです。
それぞれのオプションの詳細に関しては、lib:rdoc#usage を参照してくだ
さい。
===[a:custom_options] カスタムオプション
RDoc のジェネレータでは、RDoc::Options をフックして独自の
オプションを指定できます。
Objec......に setup_options メソッドを呼び出し
ます。カスタムオプションを指定する場合は --format オプションは必ず指定
する必要があります。rdoc --help を実行すると追加したオプションの一覧が
確認できます。
例:
class RDoc::Generator:......self.setup_options rdoc_options
op = rdoc_options.option_parser
op.on('--spell-dictionary DICTIONARY',
RDoc::Options::Path) do |dictionary|
# RDoc::Options に spell_dictionary アクセサの定義が必要
rdoc_options.spell_dictionary = dictionary
en... -
Thread
:: Backtrace :: Location (6007.0) -
Ruby のフレームを表すクラスです。
...tions から生成されます。
//emlist[例1][ruby]{
# caller_locations.rb
def a(skip)
caller_locations(skip)
end
def b(skip)
a(skip)
end
def c(skip)
b(skip)
end
c(0..2).map do |call|
puts call.to_s
end
//}
例1の実行結果:
caller_locations.rb:2:in `a'
caller_locations.rb:5:in......ions.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|
puts call.to_s
end
//}
例2の実行結果:
init.rb:4:in `initialize'
init.rb:8:in `new'
ini......t.rb:8:in `<main>'
=== 参考
* Ruby VM アドベントカレンダー #4 vm_backtrace.c: https://www.atdot.net/~ko1/diary/201212.html#d4...