るりまサーチ

最速Rubyリファレンスマニュアル検索!
72件ヒット [1-72件を表示] (0.033秒)

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

BasicObject#!=(other) -> bool (18124.0)

オブジェクトが other と等しくないことを判定します。

...否定して返します。
このため、サブクラスで BasicObject#== を再定義しても != とは自動的に整合性が
とれるようになっています。

ただし、 BasicObject#!= 自身や BasicObject#! を再定義した際には、ユーザーの責任で
整合性を保た...
...sicObject#!

//emlist[例][ruby]{
class NonequalityRecorder < BasicObject
def initialize
@count = 0
end
attr_reader :count

def !=(other)
@count += 1
super
end
end
recorder = NonequalityRecorder.new

recorder != 1
puts 'hoge' if recorder != "str"

p recorder.count #=> 2
//}...

ruby 1.8.4 feature (84.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...* ((<ruby 1.8.4 feature/"Ruby/Tk">))
* ((<ruby 1.8.4 feature/REXML [compat]>))
* ((<ruby 1.8.4 feature/TCPSocket#initialize [bug]>))
* ((<ruby 1.8.4 feature/TCPServer#initialize [bug]>))
* ((<ruby 1.8.4 feature/"optparse">))
* ((<ruby 1.8.4 feature/"find">))
* ((<ruby 1.8.4 feature/Iconv...
...ました。((<ruby-dev:27964>))

module Foo
def initialize
super
end
end

class Bar
include Foo
def initialize
Foo.instance_method(:initialize).bind(self).call
end
end

Bar.new...
...* ruby.h (Qfalse, Qtrue, Qnil, Qundef): make sure these immediate
# values have VALUE type. there is an environment where sizeof(VALUE)
# != sizeof(int) like IA64. if 32bit integer (Qtrue) is passed to ANYARGS
# and received by 64bit integer (VALUE), upper bits may have garba...

tsort (24.0)

tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。

...

非常に単純な `make' に似たツールは以下のように実装できます。

//emlist[][ruby]{
require 'tsort'

class Make
def initialize
@dep = {}
@dep.default = []
end

def rule(outputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @d...
...ep[f] = [triple]}
@dep[triple] = inputs
end

def build(target)
each_strongly_connected_component_from(target) {|ns|
if ns.length != 1
fs = ns.delete_if {|n| Array === n}
raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
end
n = ns.first...
...Errno::ENOENT
outputs_time = nil
end
if outputs_time == nil ||
inputs_time != nil && outputs_time <= inputs_time
sleep 1 if inputs_time != nil && inputs_time.to_i == Time.now.to_i
block.call
end
end
}
end

def tsort_eac...

演算子式 (24.0)

演算子式 * assign * selfassign * multiassign * range * range_cond * and * or * not * cond

.../ %
+ -
<< >>
&
| ^
> >= < <=
<=> == === != =~ !~
&&
||
.. ...
?:(条件演算子)
=(+=, -= ... )...
...の記法を利用します。


//emlist{
| ^ & <=> == === =~ > >= < <= << >>
+ - * / % ** ~ +@ -@ [] []= ` ! != !~
//}
これらの演算子式の定義方法についてはd:spec/def#operatorを参照してください。

:再定義できない演算子(...
...ての、式 2 から式 n までを
引数とする []= メソッド呼び出しに変換されます。

//emlist[例][ruby]{
class C
def initialize
@ary = [0,1,2,3,4,5,6,7]
end
def [](i)
@ary[i * 2]
end
def []=( i, v )
@ary[i * 2] = v
end
end
c = C.new
p c[3] # c.[]...

Observable (18.0)

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

...etch a stock price.
include Observable

def initialize(symbol)
@symbol = symbol
end

def run
last_price = nil
loop do
price = Price.fetch(@symbol)
print "Current price: #{price}\n"
if price != last_price
changed # no...
...- 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 1.9 feature (18.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 のセ...
...ックを渡せるようになり、ブロックが真になる要素の個数を返すように
なりました。

[1,2,3].nitems{|i| i % 2 != 0} #=> 2

((<ruby-talk:134083>))

=== 2005-06-02
: proc [ruby][parser][experimental]

以前のローカル変数に括弧を付けると call...