るりまサーチ

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

別のキーワード

  1. kernel spawn
  2. kernel exec
  3. kernel system
  4. kernel open
  5. kernel raise

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 3 > >>

Kernel#try_link(src, opt = "", *options) -> bool (9007.0)

C プログラムのソースコード src をコンパイル、リンクします。

...たら false を返します。

@param src C プログラムのソースコードを指定します。

@param opt リンカにコマンド引数として渡す値を指定します。

例:

require 'mkmf'
if try_link("int main() { sin(0.0); }", '-lm')
$stderr.puts "sin() exists"
end...

Kernel#try_link(src, opt = "", *options) { ... } -> bool (9007.0)

C プログラムのソースコード src をコンパイル、リンクします。

...たら false を返します。

@param src C プログラムのソースコードを指定します。

@param opt リンカにコマンド引数として渡す値を指定します。

例:

require 'mkmf'
if try_link("int main() { sin(0.0); }", '-lm')
$stderr.puts "sin() exists"
end...

Enumerator#next -> object (37.0)

「次」のオブジェクトを返します。

...s do
puts
enum.next
end
# => 120
# 121
# 122
//}

//emlist[例2][ruby]{
str = "xyz"
enum = str.each_byte

begin
puts
enum.next while true
rescue StopIteration
puts
"iteration reached at end"
end
# => 120
# 121
# 122
# iteration reached at end
puts
enu...
...m.next
#=> 再度 StopIteration 例外が発生
//}

//emlist[例3: Kernel.#loop は StopIteration を捕捉します。][ruby]{
str = "xyz"
enum = str.each_byte
loop do
puts
enum.next
end
# => 120
# 121
# 122
//}...

Module#alias_method(new, original) -> Symbol (31.0)

メソッドの別名を定義します。

...メソッドの別名を定義します。

//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end
//}

alias との違いは以下の通りです。

* メソッド名は String または Symbol で指定します
* グローバル...
...ます。

@param original 元のメソッド名。String または Symbol で指定します。

@return 作成したエイリアスのメソッド名を表す Symbol を返します。

@see d:spec/def#alias

//emlist[例][ruby]{
module Kernel
alias_method :foo, :puts
end

foo "bar" # bar
//}...

Module#alias_method(new, original) -> self (31.0)

メソッドの別名を定義します。

...メソッドの別名を定義します。

//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => Kernel
end
//}

alias との違いは以下の通りです。

* メソッド名は String または Symbol で指定します
* グローバル変数の別名をつけることはで...
...いメソッド名。String または Symbol で指定します。

@param original 元のメソッド名。String または Symbol で指定します。

@return self を返します。

@see d:spec/def#alias

//emlist[例][ruby]{
module Kernel
alias_method :foo, :puts
end

foo "bar" # bar
//}...

絞り込み条件を変える

Object#to_s -> String (31.0)

オブジェクトの文字列表現を返します。

...を返します。

Kernel
.#print や Kernel.#sprintf は文字列以外の
オブジェクトが引数に渡された場合このメソッドを使って文字列に変換し
ます。

//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)

puts
it #=> #<Foo:0x2...
...b69110>

class Foo
def to_s
"Class:Foo Number:#{@num}"
end
end

puts
it #=> Class:Foo Number:40
//}

@see Object#to_str,Kernel.#String...

FileUtils#sh(*cmd) {|result, status| ... } (25.0)

与えられたコマンドを実行します。

... Kernel.#exec を参照してください。


例:
sh %{ls -ltr}

sh 'ls', 'file with spaces'

# check exit status after command runs
sh %{grep pattern file} do |ok, res|
if ! ok
puts
"pattern not found (status = #{res.exitstatus})"
end
end

@see Kernel.#exe...

Method#owner -> Class | Module (25.0)

このメソッドが定義されている class か module を返します。

...定義されている class か module を返します。

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.owner # => Foo

m = Foo.new.method(:puts) # => #<Method: Foo(Kernel)#puts>
m.owner # => Kernel
//}...

Thread::Backtrace::Location#to_s -> String (23.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts
call.to_s
end

# => pat...

UnboundMethod#bind_call(recv, *args) -> object (13.0)

self を recv に bind して args を引数として呼び出します。

...self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts
Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@see UnboundMethod#bind, Method#call...

絞り込み条件を変える

UnboundMethod#bind_call(recv, *args) { ... } -> object (13.0)

self を recv に bind して args を引数として呼び出します。

...self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts
Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@see UnboundMethod#bind, Method#call...
<< < 1 2 3 > >>