別のキーワード
ライブラリ
- ビルトイン (84)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - IO (12)
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (5) - irb (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) - spawn (48)
検索結果
先頭5件
-
Marshal
. # dump(obj , limit = -1) -> String (18132.0) -
obj を指定された出力先に再帰的に出力します。
...クを持った Hash は
Proc を間接的に指していることになります。
//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}
マーシャルの動作を任意に定義することもできます。
@param obj ダン......オブジェクトをダンプしようとした場合に発生します。
@raise ArgumentError limit 段以上深くリンクしたオブジェクトをダンプしようと
した場合に発生します。
@see Object#marshal_dump, Object#marshal_load... -
Marshal
. # dump(obj , port , limit = -1) -> IO (18132.0) -
obj を指定された出力先に再帰的に出力します。
...クを持った Hash は
Proc を間接的に指していることになります。
//emlist[例][ruby]{
p Marshal.dump(Hash.new {})
# => -:1:in `dump': cannot dump hash with default proc (TypeError)
//}
マーシャルの動作を任意に定義することもできます。
@param obj ダン......オブジェクトをダンプしようとした場合に発生します。
@raise ArgumentError limit 段以上深くリンクしたオブジェクトをダンプしようと
した場合に発生します。
@see Object#marshal_dump, Object#marshal_load... -
Marshal フォーマット (570.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...なります。
//emlist[][ruby]{
p Marshal.dump(nil).unpack1("x2 a*") # => "0"
p Marshal.dump(true).unpack1("x2 a*") # => "T"
p Marshal.dump(false).unpack1("x2 a*") # => "F"
//}
Ruby 2.1 以前では、インスタンス変数を設定しても dump されません。
Ruby 2.2 以降は freeze......形式 2 との区別のためです。
//emlist[例][ruby]{
p Marshal.dump(-1).unpack1("x2 a*") # => "i\xFA"
p Marshal.dump(0).unpack1("x2 a*") # => "i\x00"
p Marshal.dump(1).unpack1("x2 a*") # => "i\x06"
p Marshal.dump(2).unpack1("x2 a*") # => "i\a" ("i\x07")
//}
形式 1 の範囲を超...... dump | ... |
//}
//emlist[例][ruby]{
p Marshal.dump([true, false, nil]).unpack("x2 a c a a a")
# => ["[", 8, "T", "F", "0"]
//}
=== Hash
==== Hash without default value
'{' で始まるデータ構造になります。
//emlist{
| '{' | 要素数(Fixnum形式) | キーの dump | 値の dump |... -
NEWS for Ruby 2
. 0 . 0 (114.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...します
* Hash
* 追加: Hash#to_h 明示的に変換するメソッドです。Array#to_a に似ています
* 拡張: Hash#default_proc= default proc をクリアするために nil を渡せるようになりました
* IO
* 非推奨: IO#lines, #bytes, #chars, #codepoints......at thread creation.
default: 128KB (32bit CPU) or 256KB (64bit CPU).
* RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
creation. default: 512KB or 1024KB.
* RUBY_FIBER_VM_STACK_SIZE: vm stack size used at fiber creation.
default: 64KB or 128KB.......* HTML5 用のタグメーカーを呼び出すと CGI#header を header 要素を生成するために上書きします。
* csv
* CSV.dump と CSV.load を削除しました。ユーザーを危険なシリアライゼーションに関する脆弱性から保護するためです。... -
IO (78.0)
-
基本的な入出力機能のためのクラスです。
...ていない場合
IO からテキスト読み込みメソッドによって読み込まれた文字列のエンコーディングは Encoding.default_external
に設定されます。このとき実際の文字エンコーディングは検査されず、変換もされません。
: 外部......ンコーディング(あるいは default_internal)が指定されている場合
IO からテキスト読み込みメソッドによって読み込まれた文字列は、外部エンコーディングから
内部エンコーディング(あるいは default_internal)へと変換されます。......ad(4)
puts s.dump #=> "\x8A\xBF\x8E\x9A"
# エンコーディングがSJISへ変換されていることが分かる。
===== まとめ
以上をまとめると以下の表のようになります。Encoding.default_external は... -
NEWS for Ruby 3
. 0 . 0 (78.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...l:label-TypeProf] is experimentally bundled. It is a
type analysis tool for Ruby programs.
* Deprecation warnings are no longer shown by default (since Ruby 2.7.2).
Turn them on with `-W:deprecated` (or with `-w` to show other warnings too).
16345
* `$SAFE` and `$KCODE` are now n......it may now invoke the `block`/`unblock` scheduler hooks in a non-blocking context. 16786
* Dir
* Dir.glob and Dir.[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys and their va......ng#chomp
* String#chop
* String#delete
* String#delete_prefix
* String#delete_suffix
* String#downcase
* String#dump
* String#each_char
* String#each_grapheme_cluster
* String#each_line
* String#gsub
* String#ljust
* String#lstr... -
ruby 1
. 6 feature (78.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...合が修正されたのだそうです。
((<ruby-win32:273>))
: 2002-08-12 Hash#==
Hash オブジェクトはデフォルト値 (((<Hash/default>))) も == で等しい
ときに等しいとみなされるようになりました。
p Hash.new("foo") == Hash.new("bar")
=>......hal/Marshal.load>))
Marshal.load が 1.7 のメソッド Proc#yield を呼んでいました。
((<ruby-dev:16178>))
Marshal.load(Marshal.dump('foo'), proc {|o| p o})
=> -:1:in `load': undefined method `yield' for #<Proc:0x401b1b30> (NameError)
from -:1
ruby 1.6.7 (2......ソッドの戻り値
以下のメソッドの戻り値が正しくなりました。
((<ruby-bugs-ja:PR#182>)), ((<rubyist:1016>))
* Hash#default= が右辺を返すようになった(以前は self を返していた)。
* Dir#pos= が右辺を返すようになった(以前は self を... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (42.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への変更点(まとめ)/サポートプラットフォームの追加>))
...merge は、hash.dup.update と同じ。
Hash#merge! は、Hash#update の別名 ((<ruby-talk:59777>)), ((<ruby-dev:19463>))
: ((<Hash#default_proc|Hash/default_proc>)) [new]
追加 ((<ruby-dev:17966>))
=== IO
: ((<IO/IO.sysopen>)) [new]
: ((<Socket#sysaccept|Socket/sysaccept>)) [new]
: ((<T......LocalJumpError#reason|LocalJumpError/reason>)) [new]
追加
=== Marshal
: ((<Marshal/Object#marshal_load>)) [new]
: ((<Marshal/Object#marshal_dump>)) [new]
追加 ((<ruby-dev:21016>))
=== MatchData
: ((<MatchData#captures|MatchData/captures>)) [new]
追加。((<RCR#139>))
: ((<MatchD......(<組み込み関数/trap>)) [compat]
あるシグナルに対して、SIG_DFL や SIG_IGN が割り当てられていた場合、
文字列 "DEFAULT" や "IGNORE" を返すようになりました(以前は、nil を返
していました) ((<ruby-talk:67860>))
: ((<組み込み関数/syste... -
Kernel
. # spawn(env , program , *args , options={}) -> Integer (36.0) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...時的に子プロセスの core dump を止める
pid = spawn(command, :rlimit_core=>[0,max]) # disable core temporary.
# 子プロセスで core dump を出せるようにする
pid = spawn(command, :rlimit_core=>max) # enable core dump
# 子プロセスで core dump を出せなくする
pid = sp......awn(command, :rlimit_core=>0) # never dump core.
//}
「:chdir」で子プロセスのカレントディレクトリを変更できます。
//emlist[][ruby]{
pid = spawn(command, :chdir=>"/var/tmp")
//}
「:umask」で子プロセスの umask を指定できます。
//emlist[][ruby]{
pid = spawn......自動的に
閉じられることに注意してください。
//emlist[][ruby]{
pid = spawn(command, :close_others=>true) # close 3,4,5,... (default)
pid = spawn(command, :close_others=>false) # don't close 3,4,5,...
//}
これを利用して spawn を IO.popen のように使うことがで......//emlist[][ruby]{
pid = spawn(command, :close_others=>true) # close 3,4,5,...
pid = spawn(command, :close_others=>false) # don't close 3,4,5,... (default)
//}
これを利用して spawn を IO.popen のように使うことができます。
//emlist[][ruby]{
# similar to r = IO.popen(command)
r,...