るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

検索結果

<< 1 2 3 ... > >>

RubyVM::InstructionSequence#absolute_path -> String | nil (38213.0)

self が表す命令シーケンスの絶対パスを返します。

...irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, wor...
...ld"
end


# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"

@
see RubyVM::InstructionSequence#path...

RubyVM::InstructionSequence#path -> String (38213.0)

self が表す命令シーケンスの相対パスを返します。

...irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, wor...
...ld"
end


# irb
> iseq = RubyVM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"

@
see RubyVM::InstructionSequence#absolute_path...

Module#prepend_features(mod) -> self (24467.0)

Module#prepend から呼び出されるメソッドで、 prepend の処理の実体です。このメソッド自体は mod で指定した モジュール/クラスの継承チェインの先頭に self を追加します。

...Module#prepend から呼び出されるメソッドで、
prepend の処理の実体です。このメソッド自体は mod で指定した
モジュール/クラスの継承チェインの先頭に self を追加します。

このメソッドを上書きすることで、prepend の処理を変...
...

@
param mod prepend を呼び出したモジュール
@
return mod が返されます

//emlist[例][ruby]{
class Recorder
R
ECORDS = []
end


module X
def self.prepend_features(mod)
R
ecorder::RECORDS << mod
end

end


class A
prepend X
end


class B
include X
end


class C
prepend X
end
...
...Recorder::RECORDS # => [A, C]
//}

@
see Module#prepend, Module#prepended...

MatchData#end(n) -> Integer | nil (24268.0)

n 番目の部分文字列終端のオフセットを返します。

...

@
param n 部分文字列を指定する数値。

@
raise IndexError 範囲外の n を指定した場合に発生します。

//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.end(0) # => 6
p $~.end(1) # => 3
p $~.end(2) # => 6
p $~.end(3) # => nil
p $~.end(4) # => `end': i...
...ndex 4 out of matches (IndexError)
//}

@
see MatchData#begin...

Module#append_features(module_or_class) -> self (18343.0)

モジュール(あるいはクラス)に self の機能を追加します。

... 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...

絞り込み条件を変える

Array#at(nth) -> object | nil (18138.0)

nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。

...nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。

@
param nth インデックスを整数で指定します。
先頭の要素が 0 番目になります。nth の値が負の時には末尾から
のインデックス...
...ドによる
暗黙の型変換を試みます。

@
raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

//emlist[例][ruby]{
a = [ "a", "b", "c", "d", "e" ]
a[0] #=> "a"
a[1] #=> "b"
a...

Net::HTTP#send_request(name, path, data = nil, header = nil) -> Net::HTTPResponse (12543.0)

HTTP リクエストをサーバに送り、そのレスポンスを Net::HTTPResponse のインスタンスとして返します。

...Net::HTTPResponse のインスタンスとして返します。

@
param name リクエストのメソッド名を文字列で与えます。
@
param path リクエストのパスを文字列で与えます。
@
param data リクエストのボディを文字列で与えます。
@
param header リク...
...エストのヘッダをハッシュで与えます。

//emlist[例][ruby]{
r
esponse = http.send_request('GET', '/index.html')
puts response.body
//}

@
see Net::HTTP#request...

Exception#backtrace_locations -> [Thread::Backtrace::Location] (12437.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
r
equire "date"
def check_long_month(month)
r
eturn if Date.new...
...1
r
aise "#{month} is not long month"
end


def get_exception
r
eturn begin
yield
r
escue => e
e
end

end


e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb...
...:15:in `<main>'"]
//}

@
see Exception#backtrace...

Module#private_method_defined?(name, inherit=true) -> bool (12367.0)

インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が private であるときに true を返します。 そうでなければ false を返します。

...ジュールに定義されており、
しかもその可視性が private であるときに true を返します。
そうでなければ false を返します。

@
param name Symbol か String を指定します。
@
param inherit 真を指定するとスーパークラスや include したモジ...
...

@
see Module#method_defined?, Module#public_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module A
def method1() end
end

class B
private
def method2() end
end

class C < B
include A
def method3() end
end


A.method_defined? :method1 #=> true...
...C.private_method_defined? "method1" #=> false
C.private_method_defined? "method2" #=> true
C.private_method_defined? "method2", true #=> true
C.private_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> false
//}...
<< 1 2 3 ... > >>