るりまサーチ

最速Rubyリファレンスマニュアル検索!
4798件ヒット [4301-4400件を表示] (0.069秒)

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < ... 42 43 44 45 46 ... > >>

Shell#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (58.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...
Kernel
.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...
...

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p
sh[?e, "foo"] # => true
p
sh[:e, "foo"] # => true
p
sh["e", "foo"] # => true
p
sh[:exist...
...s?, "foo"] # => true
p
sh["exists?", "foo"] # => true

@see Kernel.#test, FileTest...

Shell#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (58.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...
Kernel
.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...
...

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p
sh[?e, "foo"] # => true
p
sh[:e, "foo"] # => true
p
sh["e", "foo"] # => true
p
sh[:exist...
...s?, "foo"] # => true
p
sh["exists?", "foo"] # => true

@see Kernel.#test, FileTest...

Shell::Filter#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (58.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...
Kernel
.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...
...

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p
sh[?e, "foo"] # => true
p
sh[:e, "foo"] # => true
p
sh["e", "foo"] # => true
p
sh[:exist...
...s?, "foo"] # => true
p
sh["exists?", "foo"] # => true

@see Kernel.#test, FileTest...

Shell::Filter#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (58.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...
Kernel
.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...
...

@param file2 文字列でファイルへのパスを指定します。

require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p
sh[?e, "foo"] # => true
p
sh[:e, "foo"] # => true
p
sh["e", "foo"] # => true
p
sh[:exist...
...s?, "foo"] # => true
p
sh["exists?", "foo"] # => true

@see Kernel.#test, FileTest...

Object#freeze -> self (48.0)

オブジェクトを凍結(内容の変更を禁止)します。

...数なら Kernel.#trace_var が使えます。

@return self を返します。

//emlist[][ruby]{
a1 = "foo".freeze
a1 = "bar"
p
a1 #=> "bar"

a2 = "foo".freeze
a2.replace("bar") # can't modify frozen String (RuntimeError)
//}

凍結を解除することはできませんが、Object#dup を使え...
...ます。

//emlist[][ruby]{
a = [1].freeze
p
a.frozen? #=> true

a[0] = "foo"
p
a # can't modify frozen Array (RuntimeError)

b = a.dup
p
b #=> [1]
p
b.frozen? #=> false

b[0] = "foo"
p
b #=> ["foo"]
//}

@see Object#frozen?,Object#dup,Kernel.#trace_var...
...数なら Kernel.#trace_var が使えます。

@return self を返します。

//emlist[][ruby]{
a1 = "foo".freeze
a1 = "bar"
p
a1 #=> "bar"

a2 = "foo".freeze
a2.replace("bar") # can't modify frozen String (FrozenError)
//}

凍結を解除することはできませんが、Object#dup を使え...
...ます。

//emlist[][ruby]{
a = [1].freeze
p
a.frozen? #=> true

a[0] = "foo"
p
a # can't modify frozen Array (FrozenError)

b = a.dup
p
b #=> [1]
p
b.frozen? #=> false

b[0] = "foo"
p
b #=> ["foo"]
//}

@see Object#frozen?,Object#dup,Kernel.#trace_var...

絞り込み条件を変える

StringIO.new(string = &#39;&#39;, mode = &#39;r+&#39;) -> StringIO (48.0)

StringIO オブジェクトを生成して返します。

...ます。

@param string 生成される StringIO のデータを文字列で指定します。
この文字列はバッファとして使われます。StringIO#write などによって、
string 自身も書き換えられます。

@param mode Kernel.#open 同様文字...
...@raise Errno::EACCES string がフリーズされていて、mode が書き込み可能に設定されている場合に発生します。

//emlist[例][ruby]{
require 'stringio'

s = "foo"
io = StringIO.new(s)
p
io.getc # => 102
p
io.pos # => 1
p
io.size # => 3
io << "bar"
p
...
...io.size # => 4
p
s # => "fbar"
io.rewind
p
io.gets # => "fbar"

StringIO.open("hoge"){|io|
p
io.string # => "hoge"
}
//}...

Module#autoload(const_name, feature) -> nil (46.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoload...
...しません。

@param const_name String または Symbol で指定します。
なお、const_name には、"::" 演算子を含めることはできません。
つまり、self の直下に定義された定数しか指定できません。

@param feature Kernel.#require と同様...
...tmp/foo.rb ---------
class Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----

class Foo
autoload :Bar, '/tmp/foo'
end
p
Foo::Bar #=> Foo::Bar
//}

以下のようにモジュールを明示的にレシーバとして呼び出すこともできます。

//emlist[例][ruby]{
# ------- /tmp/...

NEWS for Ruby 2.5.0 (42.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...の更新

* Array
* Array#append を追加 12746
* Array#prepend を追加 12746

* Data
* 非推奨になりました。C拡張のベースクラスでしたが、Rubyレベルに公開するのをやめました。3072

* Exception
* Exception#full_message を追加 14141 [...
...Integer#pow を追加 12508 11003
* Integer#allbits?, Integer#anybits?, Integer#nobits? を追加 12753
* Integer.sqrt を追加 13219

* Kernel
* Object#yield_self を追加 6721
* Kernel.#pp をrequireなしで使えるようにしました 14123
* Kernel.#warn :uplevel...
...。7688

* Process
* getrusage(2) が存在する場合 Process.#times の精度を改良しました 11952
* Process.last_status を追加。$? と同じです 14043

* Range
* Range.new no longer hides exceptions when comparing begin and
end with #<=> and raise a "bad value f...

Object#class -> Class (42.0)

レシーバのクラスを返します。

...レシーバのクラスを返します。

//emlist[][ruby]{
p
"ruby".class #=> String
p
100.class #=> Integer
p
ARGV.class #=> Array
p
self.class #=> Object
p
Class.class #=> Class
p
Kernel.class #=> Module
//}

@see Class#superclass,Object#kind_of?,Object#instance_of?...

FileTest.#identical?(file1, file2) -> bool (36.0)

file1 と file2 が同じファイルを指している時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...y 1.8.3 以前ではKernel.#test(?-, file1, file2)を使ってください。

open("a", "w") {}
p
File.identical?("a", "a") #=> true
p
File.identical?("a", "./a") #=> true
File.link("a", "b")
p
File.identical?("a", "b") #=> true
File.symlink("a", "c")
p
File.identical?("a...
..."c") #=> true
open("d", "w") {}
p
File.identical?("a", "d") #=> false

@param file1 ファイル名を表す文字列か IO オブジェクトを指定します。

@param file2 ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定され...

絞り込み条件を変える

Module#constants(inherit = true) -> [Symbol] (36.0)

そのモジュール(またはクラス)で定義されている定数名の配列を返します。

...ません。

@param inherit true を指定するとスーパークラスや include したモジュールで
定義された定数が対象にはなります。false を指定した場合 対象にはなりません。

@see Module.constants, Kernel.#local_variables, Kernel.#global_variables...
...nd
class Bar
BAR = 1

# Bar は BAR を含む
p
constants # => [:BAR]
# 出力に FOO は含まれない
p
Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p
constants # => []

#...
...ネストしたクラスでは、外側のクラスで定義した定数は
# 参照可能なので、BAR は、Module.constants には含まれる
# (クラス Baz も Bar の定数なので同様)
p
Module.constants - $clist # => [:BAR, :Baz, :Foo, :Bar]
end
end
//}...
<< < ... 42 43 44 45 46 ... > >>