るりまサーチ (Ruby 2.2.0)

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.031秒)
トップページ > バージョン:2.2.0[x] > クエリ:Class[x] > 種類:クラス[x]

別のキーワード

  1. argf.class lines
  2. argf.class each
  3. argf.class each_line
  4. class new
  5. argf.class gets

検索結果

Class (114040.0)

クラスのクラスです。

...正確に言えば、個々のクラスはそれぞれメタクラスと呼
ばれる名前のないクラスをクラスとして持っていて、Class はそのメタ
クラスのクラスです。この関係は少し複雑ですが、Ruby を利用するにあたっ
ては特に重要ではあ...
...すが、それ以外のほとんどの機能は Module から継
承されています。Module のメソッドのうち

* Module#module_function
* Module#extend_object
* Module#append_features
* Module#prepend_features
* Module#refine

Class では未定義にされています。...

Digest::Class (54004.0)

ARGF.class (18004.0)

ARGF を表すクラスです。

ARGF を表すクラスです。

FalseClass (18004.0)

false のクラス。 false は FalseClass クラスの唯一のインスタンスです。 false は nil オブジェクトとともに偽を表し、 その他の全てのオブジェクトは真です。

...false のクラス。
false は FalseClass クラスの唯一のインスタンスです。
false は nil オブジェクトとともに偽を表し、
その他の全てのオブジェクトは真です。...

NilClass (18004.0)

nil のクラス。 nil は NilClass クラスの唯一のインスタンスです。 nil は false オブジェクトとともに偽を表し、 その他の全てのオブジェクトは真です。

...nil のクラス。
nil は NilClass クラスの唯一のインスタンスです。
nil は false オブジェクトとともに偽を表し、
その他の全てのオブジェクトは真です。...

絞り込み条件を変える

RDoc::AnonClass (18004.0)

匿名クラスを表現するクラスです。

匿名クラスを表現するクラスです。

現在は使用されていません。

RDoc::ClassModule (18004.0)

クラスやモジュールを表現するための基本クラスです。

クラスやモジュールを表現するための基本クラスです。

ライブラリの内部で使用します。

RDoc::NormalClass (18004.0)

クラスを表現するためのクラスです。

クラスを表現するためのクラスです。

特異クラスや匿名クラスは含まれません。

ライブラリの内部で使用します。

RDoc::SingleClass (18004.0)

特異クラスを表現するクラスです。

特異クラスを表現するクラスです。

ライブラリの内部で使用します。

TrueClass (18004.0)

true のクラス。 true は TrueClass クラスの唯一のインスタンスです。 true は真を表す代表のオブジェクトです。

...true のクラス。
true は TrueClass クラスの唯一のインスタンスです。
true は真を表す代表のオブジェクトです。...

絞り込み条件を変える

Fiddle::Closure (58.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){...

Method (58.0)

Object#method によりオブジェクト化され たメソッドオブジェクトのクラスです。

...、Method は大規模コードに向くと言えます。


既存のメソッドを Method オブジェクト化する。

//emlist[例][ruby]{
class
Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo)

p m # => #<Method: Foo#foo>
p m.call(1) # =...
...cc>
p pr.call(1) # => "proc called with arg 1"
//}

Method オブジェクトが有用なのは以下のような場合。

//emlist[例][ruby]{
class
Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end

obj = Foo.new

# 任意のキーとメソッドの関係をハッシュ...
...(Method オブジェクトはレシーバを保持する)必
要がないなら Object#public_sendを使う方法も有用。

//emlist[例][ruby]{
class
Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end

# 任意のキーとメソッド(の名前)の関係をハッシュに...

Ripper::Filter (58.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 (52.0)

Psych 内部で利用する各種 Visitor class を保持しているモジュール。

...Psych 内部で利用する各種 Visitor class を保持しているモジュール。...

Timeout::Error (40.0)

timeout で定義される例外クラスです。 関数 timeout がタイムアウトすると発生します。

...ror のサブクラスを
定義して使用した方が無難です。

==> foo.rb <==
require 'timeout.rb'
class
Foo
FooTimeoutError = Class.new(TimeoutError)
def longlongtime_method
Timeout.timeout(100, FooTimeoutError) {
......

絞り込み条件を変える

UnboundMethod (40.0)

レシーバを持たないメソッドを表すクラスです。 呼び出すためにはレシーバにバインドする必要があります。

...とができます。

//emlist[例: Method クラスの冒頭にある例を UnboundMethod で書くと以下のようになります。][ruby]{
class
Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end

# 任意のキーとメソッドの関係をハッシュに保持して...
...mlist[例: 以下はメソッドの再定義を UnboundMethod を使って行う方法です。普通は alias や super を使います。][ruby]{
class
Foo
def foo
p :foo
end
@@orig_foo = instance_method :foo
def foo
p :bar
@@orig_foo.bind(self).call
end
end

Foo.new.foo

# =...

BasicObject (22.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...

Etc::Passwd (22.0)

Etc.#getpwent で得られる構造体。

...ステムには反映されません。

全てのシステムで提供されているメンバ。
* name
* passwd
* uid
* gid
* gecos
* dir
* shell

以降のメンバはシステムによっては提供されません。
* change
* quota
* age
* class
* comment
* expire...

Numeric (22.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...

Psych::Parser (22.0)

YAML のパーサ。

...

以下の例では YAML ドキュメント に含まれているスカラー値を表示します。

# Handler for detecting scalar values
class
ScalarHandler < Psych::Handler
def scalar value, anchor, tag, plain, quoted, style
puts value
end
end

parser = Psych::Parser.n...

絞り込み条件を変える

RDoc::Markup (22.0)

RDoc 形式のドキュメントを目的の形式に変換するためのクラスです。

...フォーマットを行うようにパーサを拡張する事もできます。


例:

require 'rdoc/markup'
require 'rdoc/markup/to_html'

class
WikiHtml < RDoc::Markup::ToHtml
# WikiWord のフォントを赤く表示。
def handle_special_WIKIWORD(special)
"<font color=red>...

RDoc::Options (22.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 (22.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 (22.0)

スレッドの同期機構の一つである状態変数を実現するクラスです。

...が空になった場合、
あるいは満タンになった場合に Condition Variable を使って wait しています。

require 'thread'

class
TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mut...