1379件ヒット
[1-100件を表示]
(0.056秒)
種類
- インスタンスメソッド (1018)
- 特異メソッド (177)
- モジュール関数 (121)
- 定数 (44)
- クラス (19)
クラス
-
ARGF
. class (66) - Array (116)
- Class (11)
- Data (6)
- Dir (99)
- Enumerator (143)
-
Enumerator
:: Chain (18) -
Enumerator
:: Lazy (55) -
Enumerator
:: Yielder (22) - File (33)
- Hash (58)
- MatchData (11)
- Module (45)
- Object (134)
- Random (33)
- Range (11)
- Rational (11)
- Regexp (22)
- StopIteration (11)
- String (30)
- Struct (28)
- Thread (11)
- TracePoint (10)
モジュール
- Enumerable (231)
- GC (24)
- Kernel (88)
- ObjectSpace (33)
キーワード
- << (11)
- == (2)
- DATA (11)
- Data (8)
- Enumerator (11)
- Float (11)
-
RUBY
_ PATCHLEVEL (11) -
RUBY
_ PLATFORM (11) -
RUBY
_ RELEASE _ DATE (11) - Rational (11)
- [] (44)
- allocate (11)
- bsearch (22)
- catch (22)
- chdir (33)
- collect (22)
-
const
_ source _ location (5) - cycle (11)
-
delete
_ at (11) -
deprecate
_ constant (9) - detect (11)
- each (78)
-
each
_ byte (11) -
each
_ char (11) -
each
_ line (22) -
each
_ object (22) -
each
_ with _ object (11) -
enum
_ for (44) - eql? (2)
- feed (11)
-
fetch
_ values (18) - filter (18)
-
filter
_ map (5) - find (11)
-
find
_ all (11) - force (11)
- format (11)
-
garbage
_ collect (11) - grep (22)
-
grep
_ v (22) -
handle
_ interrupt (11) - hash (13)
- index (7)
- key (11)
-
latest
_ gc _ info (22) - loop (11)
- map (22)
- match (44)
-
max
_ by (22) -
min
_ by (22) -
minmax
_ by (11) - new (33)
- next (11)
-
next
_ values (11) - open (66)
- partition (11)
- peek (11)
-
peek
_ values (11) -
private
_ constant (9) -
private
_ instance _ methods (11) -
private
_ methods (11) - rand (33)
- reject (22)
-
remove
_ const (11) -
require
_ relative (11) -
respond
_ to _ missing? (11) - result (11)
- rewind (6)
- select (33)
-
sort
_ by (11) - sprintf (11)
- stat (12)
- string (11)
- then (6)
-
to
_ enum (44) -
to
_ regexp (11) - unpack1 (8)
-
values
_ at (22) -
with
_ index (22) -
with
_ object (22) - yield (11)
-
yield
_ self (7)
検索結果
先頭5件
-
Object
# private _ methods(include _ inherited = true) -> [Symbol] (27114.0) -
そのオブジェクトが理解できる private メソッド名の一覧を返します。
...が理解できる private メソッド名の一覧を返します。
@param include_inherited 偽となる値を指定すると自身のクラスのスーパークラスで定義されたメソッドを除きます。
@see Module#private_instance_methods,Object#methods,Object#singleton_methods... -
Object
:: DATA -> File (27102.0) -
スクリプトの __END__ プログラムの終り以降をアクセスする File オブジェクト。
...ジェクト。
d:spec/program#terminateも参照。
ソースファイルの __END__ 以降は解析・実行の対象にならないので
その部分にプログラムが利用するためのデータを書き込んでおくことができます。
DATA 定数はそのデータ部分にアク......するための File オブジェクトを保持しています。
__END__ を含まないプログラムにおいては DATA は定義されません。
=== 注意
* DATA.rewind で移動する読みとり位置は __END__ 直後ではなく、
スクリプトファイルの先頭で......ファイル ($0) を指します。
=== 例1
print DATA.gets # => 故人西辞黄鶴楼
print DATA.gets # => 烟花三月下揚州
print DATA.gets # => 孤帆遠影碧空尽
print DATA.gets # => 唯見長江天際流
DATA.gets # => nil
__END__
故人西辞黄... -
Object
:: RUBY _ PATCHLEVEL -> Integer (27102.0) -
Ruby のパッチレベルを表す Integer オブジェクトです。
...eeny リリースに対してバグ修正パッチが適用される度に増えていきます。
パッチレベルという概念および RUBY_PATCHLEVEL 定数は、 Ruby 1.8.5-p1 以降、 1.8.6 以降で導入されました。
1.8.5やそれ以前のバージョンでは定義されてい... -
Object
:: RUBY _ PLATFORM -> String (27102.0) -
プラットフォームを表す文字列。
プラットフォームを表す文字列。 -
Object
:: RUBY _ RELEASE _ DATE -> String (27102.0) -
Ruby のリリース日を表す文字列。
Ruby のリリース日を表す文字列。 -
Object
# respond _ to _ missing?(symbol , include _ private) -> bool (21114.0) -
自身が symbol で表されるメソッドに対し BasicObject#method_missing で反応するつもりならば真を返します。
...れるメソッドに対し
BasicObject#method_missing で反応するつもりならば真を返します。
Object#respond_to? はメソッドが定義されていない場合、
デフォルトでこのメソッドを呼びだし問合せます。
BasicObject#method_missing を override した......このメソッドも
override されるべきです。
false を返します。
@param symbol メソッド名シンボル
@param include_private private method も含めたい場合に true が渡されます
//emlist[例][ruby]{
class Sample
def method_missing(name, *args)
if name =~ /^to......end
end
def respond_to_missing?(sym, include_private)
(sym =~ /^to_*/) ? true : super
end
end
s = Sample.new
s.to_sample("sample args1", "sample args2")
s.respond_to?(:to_sample) # => true
s.respond_to?(:sample) # => false
//}
@see Object#respond_to?, BasicObject#method_missing... -
Object
# then -> Enumerator (21110.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...s).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。
例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yie... -
Object
# yield _ self -> Enumerator (21110.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...s).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。
例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yie... -
Object
# enum _ for(method = :each , *args) -> Enumerator (21102.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method_......each do |*val|
n.times { yield *val }
end
end
end
%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}
@see Enumerator, Enumerator#size... -
Object
# enum _ for(method = :each , *args) {|*args| . . . } -> Enumerator (21102.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method_......each do |*val|
n.times { yield *val }
end
end
end
%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}
@see Enumerator, Enumerator#size...