るりまサーチ

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

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. t61string new
  4. matrix t
  5. fiddle type_size_t

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 3 4 ... > >>

Set#classify {|o| ... } -> Hash (9113.0)

集合をブロックの値によって分類し、結果をハッシュとして返します。

...ます。

生成されるハッシュのキーはブロックの実行結果、値は分類された集合と
なります。

//emlist[][ruby]{
require 'set'
numbers = Set[10, 4.5, 20, 30, 31.2]
p numbers.classify {|o| o.class}
# => {Integer=>#<Set: {10, 20, 30}>, Float=>#<Set: {4.5, 31.2}>}
//}...
...
渡されます。

生成されるハッシュのキーはブロックの実行結果、値は分類された集合と
なります。

//emlist[][ruby]{
numbers = Set[10, 4.5, 20, 30, 31.2]
p numbers.classify {|o| o.class}
# => {Integer=>#<Set: {10, 20, 30}>, Float=>#<Set: {4.5, 31.2}>}
//}...

ARGF.class#tell -> Integer (6309.0)

ARGFが現在開いているファイルのファイルポインタの現在の位置をバイト単位 の整数で返します。

...ARGFが現在開いているファイルのファイルポインタの現在の位置をバイト単位
の整数で返します。

ARGF.pos # => 0
ARGF.gets # => "This is line one\n"
ARGF.pos # => 17

@see IO#pos, IO#tell, ARGF.class#pos=...

IO#readbyte -> Integer (6308.0)

IO から1バイトを読み込み整数として返します。 既に EOF に達していれば EOFError が発生します。

...EOF に達している場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "123")
File.open("testfile") do |f|
begin
f.readbyte # => 49
f.readbyte # => 50
f.readbyte # => 51
f.readbyte # => 例外発生
rescue => e
e.class # => EOFError
end
end
//}...

Object#to_int -> Integer (6230.0)

オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。

...オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。

説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
...
...が使われるすべての場面で代置可能であるような、
* 整数そのものとみなせるようなもの
という厳しいものになっています。

//emlist[][ruby]{
class
Foo
def to_int
1
end
end

ary = [:a, :b, :c]
p(ary[Foo.new]) # => :b
//}

@see Kernel.#Integer...

Module#const_source_location(name, inherited = true) -> [String, Integer] (6220.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...@param name Symbol,String で定数の名前を指定します。
@param inherited true を指定するとスーパークラスや include したモジュールで定義された定数が対象にはなります。false を指定した場合 対象にはなりません。
@return ソースコー...
...st[例][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...
...12]
p B.const_source_location('C3') # => ["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] --...

絞り込み条件を変える

Object#public_method(name) -> Method (6219.0)

オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。

...thod オブジェクトを返します。

@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 private メソッド名を引数として与えると発生します。

//emlist...
...[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}

@see Object#method,Object#public_send,Module#public_instance_method...

URI::Generic#default_port -> Integer | nil (6218.0)

self.class.default_port を返します。

...self.class.default_port を返します。

@see URI::Generic.default_port...

Method#arity -> Integer (6208.0)

メソッドが受け付ける引数の数を返します。

...t[例][ruby]{
class
C
def u; end
def v(a); end
def w(*a); end
def x(a, b); end
def y(a, b, *c); end
def z(a, b, *c, &d); end
end

c = C.new
p c.method(:u).arity #=> 0
p c.method(:v).arity #=> 1
p c.method(:w).arity #=> -1
p c.met...
...hod(:x).arity #=> 2
p c.method(:y).arity #=> -3
p c.method(:z).arity #=> -3

s = "xyz"
s.method(:size).arity #=> 0
s.method(:replace).arity #=> 1
s.method(:squeeze).arity #=> -1
s.method(:count).arity #=> -1
//}...

Method#source_location -> [String, Integer] | nil (6208.0)

ソースコードのファイル名と行番号を配列で返します。

...@see Proc#source_location

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class
Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----

require '/tmp/foo'

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]

method(:puts).source_location # => nil
//}...
<< < 1 2 3 4 ... > >>