るりまサーチ

最速Rubyリファレンスマニュアル検索!
1337件ヒット [401-500件を表示] (0.016秒)
トップページ > クエリ:initialize[x]

別のキーワード

  1. win32ole ole_activex_initialize
  2. ri initialize
  3. object initialize
  4. darkfish initialize
  5. _builtin initialize

キーワード

検索結果

<< < ... 3 4 5 6 7 ... > >>

Observable (12.0)

Observer パターンを提供するモジュールです。

...=== サンプルコード
require "observer"

class Ticker ### Periodically fetch a stock price.
include Observable

def initialize(symbol)
@symbol = symbol
end

def run
last_price = nil
loop do
price = Price.fetch(@symbol)
print "Curr...
...- 140).
def self.fetch(symbol)
60 + rand(80)
end
end

class Warner ### An abstract observer of Ticker objects.
def initialize(ticker, limit)
@limit = limit
ticker.add_observer(self)
end
end

class WarnLow < Warner
def update(time, price) #...

Ruby用語集 (12.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...値を真偽値として用いる式。if、unless、while、until のあとなどに書かれる。

: 初期化
: initialize
オブジェクトが生成されるとき、initialize という名の private メソッドが
呼ばれる。このメソッドで行う処理をオブジェクトの...

Thread::Backtrace::Location (12.0)

Ruby のフレームを表すクラスです。

...][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'
init.rb:8:in `<main>'

=== 参考...

Thread::Backtrace::Location#base_label -> String (12.0)

self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。

...されます。

//emlist[例][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.base_label
end

# => initialize
# new
# <main>
//}

@see Thread::Backtrace::Location#label...

Thread::Backtrace::Location#inspect -> String (12.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

...st[例][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.inspect
end

# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<main>'"...

絞り込み条件を変える

Thread::Backtrace::Location#to_s -> String (12.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...mlist[例][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

# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `new'
# path/to/foo.rb:9:in `<main>'
//}...

ruby 1.9 feature (12.0)

ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。

...: 文字列のハッシュに FNV-1a hash を使用するようになりました
: Regexp#initialize でリテラルの正規表現を変更できなくなりました
: $SAFE=4 では Regexp#initialize で taint でない正規表現を変更できなくなりました
: Dir で $SAFE のセ...

セキュリティモデル (12.0)

セキュリティモデル RubyにはCGI等のプログラミングを安全に行うことを助ける為に、セキュリティ 機構が備わっています。

...IO, File, FileTest のメソッド呼び出し
//emlist{
$ ruby -e '$SAFE = 1; open(ARGV[0])' hoge
-e:1:in `initialize': Insecure operation - initialize (SecurityError)
from -e:1
//}
* ファイルテスト演算子の使用、ファイルの更新時刻...

BasicObject (6.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)
end
end

proxy = Proxy.new("1")...
<< < ... 3 4 5 6 7 ... > >>