ライブラリ
- ビルトイン (638)
-
cgi
/ core (36) - csv (24)
- dbm (48)
- delegate (12)
- erb (12)
- gdbm (48)
- ipaddr (24)
-
irb
/ ext / math-mode (4) - matrix (24)
-
minitest
/ spec (1) -
minitest
/ unit (2) - mkmf (84)
- pathname (51)
- rake (24)
-
rake
/ packagetask (12) -
rdoc
/ context (48) -
rdoc
/ text (12) -
rexml
/ document (12) -
rexml
/ parsers / sax2parser (60) -
rexml
/ streamlistener (12) -
rubygems
/ version (12) - sdbm (48)
- set (23)
- socket (12)
- tsort (93)
-
webrick
/ httpresponse (60) -
webrick
/ httpserver (24) - win32ole (36)
クラス
- Array (12)
-
CSV
:: Row (24) - DBM (48)
- Delegator (12)
- ERB (12)
- GDBM (48)
-
Gem
:: Version (12) - Hash (48)
- IPAddr (24)
-
IRB
:: Context (4) - Method (24)
- Module (264)
- Object (121)
- Pathname (51)
- Proc (6)
-
RDoc
:: Context (48) -
RDoc
:: Options (24) -
REXML
:: AttlistDecl (12) -
REXML
:: Parsers :: SAX2Parser (60) -
Rake
:: FileList (24) -
Rake
:: PackageTask (12) - Range (55)
- Refinement (4)
- SDBM (48)
- Set (32)
- Socket (12)
- String (12)
- TracePoint (12)
- UnboundMethod (12)
- Vector (24)
-
WEBrick
:: HTTPResponse (60) -
WEBrick
:: HTTPServer (24) - WIN32OLE (36)
モジュール
-
CGI
:: QueryExtension (36) - Enumerable (48)
- GC (12)
- Kernel (84)
-
MiniTest
:: Assertions (2) -
RDoc
:: Text (12) -
REXML
:: StreamListener (12) - TSort (93)
キーワード
- < (12)
- <= (12)
- <=> (12)
- === (32)
- > (12)
- >= (12)
-
_ getproperty (12) -
_ invoke (12) -
_ setproperty (12) -
add
_ include (12) -
add
_ to (12) - ancestors (12)
-
append
_ features (12) -
assert
_ includes (1) -
assert
_ send (1) - bind (12)
- body= (12)
- chunked= (12)
-
connect
_ nonblock (12) -
const
_ defined? (12) -
const
_ get (12) -
const
_ source _ location (12) - constants (12)
-
content
_ length (12) -
content
_ length= (12) - cover? (19)
-
def
_ module (12) -
defined
_ class (12) -
dir
_ config (12) - each (24)
-
each
_ child (24) -
each
_ entry (39) -
each
_ strongly _ connected _ component (23) -
each
_ strongly _ connected _ component _ from (23) -
enable
_ config (24) - entitydecl (12)
- entries (12)
- eql? (12)
- extend (12)
-
garbage
_ collect (12) -
has
_ key? (60) - header? (12)
-
import
_ methods (4) - include? (168)
-
include
_ line _ numbers (12) - included (12)
-
included
_ modules (12) - includes (12)
-
initialize
_ methods _ etc (12) - inspect (12)
-
is
_ a? (12) - key? (60)
-
kind
_ of? (12) - listen (60)
- markup (12)
-
math
_ mode= (4) - member? (84)
-
method
_ defined? (12) - methods (12)
- mount (12)
-
must
_ include (1) -
package
_ files (12) -
prepend
_ features (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) -
private
_ methods (12) -
protected
_ method _ defined? (12) -
protected
_ methods (12) -
public
_ method _ defined? (12) -
public
_ methods (12) -
rdoc
_ include (12) - resolve (12)
-
respond
_ to? (12) -
respond
_ to _ missing? (24) -
ruby2
_ keywords (18) -
singleton
_ methods (12) -
strongly
_ connected _ components (12) -
to
_ s (24) -
try
_ cpp (24) - tsort (12)
-
tsort
_ each (23) -
virtual
_ host (12) -
with
_ config (24)
検索結果
先頭5件
-
Range
# ===(obj) -> bool (37.0) -
始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。
...n 0...60 then puts "low"
when 60...80 then puts "medium" # => medium
when 80..100 then puts "high"
end
//}
2.5 以前は、単純に Range#include? メソッドを内部で呼んでいました。
しかし、2.6 以降では、(文字列を除いて) Range#cover? と同様の処理をす......e'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は、include? と同じく比較できず false を返......//emlist[例][ruby]{
p ('a'..'z').include? 'at' #=> false
p ('a'..'z').cover? 'at' #=> true
p ('a'..'z') === 'at' #=> true
# 2.6 以前は、=== は、include? と同じく比較できず false を返していました。
//}
@see d:spec/control#case
@see Range#include?, Range#cover?... -
Range
# cover?(range) -> bool (34.0) -
2.6 以降の cover? は、Range#include? や Range#=== と異なり、 引数に Range オブジェクトを指定して比較できます。
...2.6 以降の cover? は、Range#include? や Range#=== と異なり、
引数に Range オブジェクトを指定して比較できます。
引数が Range オブジェクトの場合、引数の範囲が self の範囲に含まれる時に true を返します。
@param range 比較対象の......るために succ メソッドの呼び出しが必要な)場合、パフォーマンスの問題が起きる可能性があります。
//emlist[パフォーマンス上の問題が起きる例][ruby]{
p ('aaaaa'..'zzzzy').cover?('aaaaa'...'zzzzz') # => true
//}
@see Range#include?, Range#===... -
Module
# const _ defined?(name , inherit = true) -> bool (31.0) -
モジュールに name で指定される名前の定数が定義されている時真 を返します。
...クラスや include したモジュールで定義された定数を検索対象
にするかどうかは第二引数で制御することができます。
@param name String, Symbol で指定される定数名。
@param inherit false を指定するとスーパークラスや include したモ......t は include したモジュールの定数に対しても
# true を返す
p Object.const_defined?(:FOO) # => true
module Bar
BAR = 1
end
class Object
include Bar
end
# ユーザ定義のモジュールに対しても同様
p Object.const_defined?(:BAR) # => true
class Baz
include Bar... -
Module
# const _ get(name , inherit = true) -> object (31.0) -
name で指定される名前の定数の値を取り出します。
...クラスや include したモジュールで
定義された定数は対象にはなりません。
@raise NameError 定数が定義されていないときに発生します。
//emlist[例][ruby]{
module Bar
BAR = 1
end
class Object
include Bar
end
# Object では include された......モジュールに定義された定数を見付ける
p Object.const_get(:BAR) # => 1
class Baz
include Bar
end
# Object以外でも同様
p Baz.const_get(:BAR) # => 1
# 定義されていない定数
p Baz.const_get(:NOT_DEFINED) #=> raise NameError
# 第二引数に false を指定す......ると自分自身に定義された定数から探す
p Baz.const_get(:BAR, false) #=> raise NameError
# 完全修飾名を指定すると include や自分自身へ定義されていない場合でも参照できる
p Class.const_get("Bar::BAR") # => 1
//}... -
Object
# extend(*modules) -> self (31.0) -
引数で指定したモジュールのインスタンスメソッドを self の特異 メソッドとして追加します。
...引数で指定したモジュールのインスタンスメソッドを self の特異
メソッドとして追加します。
Module#include は、クラス(のインスタンス)に機能を追加します
が、extend は、ある特定のオブジェクトだけにモジュールの機能を.......extend Foo, Bar
p obj.a #=> "ok Foo"
p obj.b #=> "ok Bar"
class Klass
include Foo
extend Bar
end
p Klass.new.a #=> "ok Foo"
p Klass.b #=> "ok Bar"
//}
extend の機能は、「特異クラスに対する Module#include」
と言い替えることもできます。
ただしその場合......、フック用のメソッド
が Module#extended ではなく Module#included になるという違いがあります。
//emlist[][ruby]{
# obj.extend Foo, Bar とほぼ同じ
class << obj
include Foo, Bar
end
//}
@see Module#extend_object,Module#include,Module#extended... -
Range
# ===(obj) -> bool (26.0) -
obj が範囲内に含まれている時に true を返します。 そうでない場合は、false を返します。
...クトを指定します。
//emlist[例][ruby]{
p ("a" .. "c").include?("b") # => true
p ("a" .. "c").include?("B") # => false
p ("a" .. "c").include?("ba") # => false
p ("a" .. "c").cover?("ba") # => true
p (1 .. 3).include?(1.5) # => true
//}
@see d:spec/control#case
@see Range#cover?... -
Range
# member?(obj) -> bool (26.0) -
obj が範囲内に含まれている時に true を返します。 そうでない場合は、false を返します。
...クトを指定します。
//emlist[例][ruby]{
p ("a" .. "c").include?("b") # => true
p ("a" .. "c").include?("B") # => false
p ("a" .. "c").include?("ba") # => false
p ("a" .. "c").cover?("ba") # => true
p (1 .. 3).include?(1.5) # => true
//}
@see d:spec/control#case
@see Range#cover?... -
Range
# ===(obj) -> bool (25.0) -
始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。
...n 0...60 then puts "low"
when 60...80 then puts "medium" # => medium
when 80..100 then puts "high"
end
//}
2.5 以前は、単純に Range#include? メソッドを内部で呼んでいました。
しかし、2.6 以降では、(文字列を除いて) Range#cover? と同様の処理をす......e'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は、include? と同じく比較できず false を返......していました。
//}
@see d:spec/control#case
@see Range#include?, Range#cover?... -
Module
# append _ features(module _ or _ class) -> self (19.0) -
モジュール(あるいはクラス)に self の機能を追加します。
...加します。
このメソッドは Module#include の実体であり、
include を Ruby で書くと以下のように定義できます。
//emlist[例][ruby]{
def include(*modules)
modules.reverse_each do |mod|
# append_features や included はプライベートメソッドなので......# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append_features, self)
mod.__send__(:included, self)
end
end
//}
@see Module#included... -
Module
# const _ source _ location(name , inherited = true) -> [String , Integer] (19.0) -
name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。
...します。
@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義された定数が対象にはなります。false を指定した場合 対象にはなりません。
@return ソ......//emlist[例][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end
module M # line 6
C3 = 3
end
class B < A # line 10
include M
C4 = 4
end
class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end
p B.const_source_location('C4') # =>......# => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]
p B.const_source_location('C3', false) # => nil -- include したモジュールは検索しない
p A.const_source_location('C2') # => ["test.rb", 16] -- 最後に定義された位置を返... -
Module
# ruby2 _ keywords(method _ name , . . . ) -> nil (17.0) -
For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.
...s marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through the method to... -
Proc
# ruby2 _ keywords -> proc (17.0) -
Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.
...s marked with a special flag such that if it is the final
element of a normal argument splat to another method call, and that
method call does not include explicit keywords or a keyword splat, the
final element is interpreted as keywords. In other words, keywords will
be passed through the proc to... -
RDoc
:: Context # initialize _ methods _ etc -> () (17.0) -
追加されたメソッド、属性、alias されたメソッド(メソッド名の対応が取れて いないものを含む)、require されたファイル、include されたファイル、定数 をクリアします。
...追加されたメソッド、属性、alias されたメソッド(メソッド名の対応が取れて
いないものを含む)、require されたファイル、include されたファイル、定数
をクリアします。...