るりまサーチ

最速Rubyリファレンスマニュアル検索!
70件ヒット [1-70件を表示] (0.057秒)
トップページ > クエリ:File[x] > クエリ:test[x] > クエリ:clone[x]

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file truncate
  4. file chown
  5. file separator

ライブラリ

クラス

モジュール

検索結果

Rake::Cloneable#clone -> object (21161.0)

自身を複製します。

...ています。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
file
_list = FileList['a.c', 'b.c']
clone
= file_list.clone
clone
# => ["a.c", "b.c"]
clone
.exclude("a.c")
clone
== file_list # => false
end
//}...

IO#clone -> IO (18161.0)

レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。

...IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。

clone
の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、
dup は内容の等しいフリーズされ...
...ていない IO を返します。

@raise IOError 既に close されていた場合に発生します。

//emlist[例][ruby]{
clone
_io = nil
IO.write("testfile", "test")
File
.open("testfile") do |io|
clone
_io = io.clone
end
clone
_io.read # => "test"
clone
_io.close
//}...

IO#dup -> IO (3061.0)

レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。

...IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。

clone
の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、
dup は内容の等しいフリーズされ...
...ていない IO を返します。

@raise IOError 既に close されていた場合に発生します。

//emlist[例][ruby]{
clone
_io = nil
IO.write("testfile", "test")
File
.open("testfile") do |io|
clone
_io = io.clone
end
clone
_io.read # => "test"
clone
_io.close
//}...

Rake::Cloneable#dup -> object (3054.0)

自身と同じクラスのオブジェクトを作成後、自身のインスタンス変数を 全て新たに作成したオブジェクトにコピーします。

...y]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
file
_list = FileList['a.c', 'b.c']
file
_list.freeze
dup = file_list.dup
clone
= file_list.clone
dup.exclude("a.c") # => ["b.c"]
clone
.exclude("a.c") # => can't modify frozen Rake::FileList
end...

1.6.8から1.8.0への変更点(まとめ) (408.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...任意
の値を返すことができます。

: 多重代入 [change]

多重代入の規則を見直しました。

# # derived from sample/test.rb
# a = *[]; p a # special case
# def f; yield; end; f {|a| p a} # add (warning)
# def r; return; end; a = r...
...り、(({$?})) の値も整数からこのクラ
スのインスタンスになりました。

=== クラス階層

: ((<File::Constants>))

File
::Constants は、File クラスでなく IO クラスが include するように
なりました。((<ruby-dev:20964>))

: ((<UnboundMethod>)) [com...
...-dev:16183>))

一つ一つ include した場合とは逆順になります。

=== Object

: ((<Object#clone|Object/clone>)) [change]

Numeric など immutable なオブジェクトは clone できなくなりました。
((<ruby-bugs-ja:PR#94>)), ((<rubyist:0831>))

=== Range

: ((<Range#max...

絞り込み条件を変える

クラス/メソッドの定義 (90.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...imit
* 定義に関する操作:
* alias
* undef
* defined

===[a:class] クラス定義

//emlist[例][ruby]{
class Foo < Super
def test
# ...
end
# ...
end
//}

文法:

class 識別子 [`<' superclass ]
式..
end

文法:

class...
... File::Constants を include することで、
# File::RDONLY などと書かずに直接 RDONLY と書くことができる。
class File
module Constants
RDONLY = 0
WRONLY = 1
end
include Constants
end

File
.open("foo", File::RDONLY)

# あるいは

include File::Constants
File
.ope...
...す。この構文の内部で定義したメソッドや定数は指定した
オブジェクトに対してだけ有効になります。
Object#clone で生成したオブジェクトには引き継がれますが,
Object#dup で生成したオブジェクトには引き継がれません.

r...

NEWS for Ruby 3.0.0 (60.0)

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

...e each second element
# => ["data1", "data2", "data3"]
//}

* Binding
* Binding#eval when called with one argument will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352 17419
* ConditionVariable
* ConditionVariable#wait may now invoke the `block`/`unblock`...
...`true` will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, so please test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except h...
...tion context. 16786
* Kernel
* Kernel#clone when called with the `freeze: false` keyword will call `#initialize_clone` with the `freeze: false` keyword. 14266
* Kernel#clone when called with the `freeze: true` keyword will call `#initialize_clone` with the `freeze: true` keyword, and will...