種類
- 文書 (64)
- インスタンスメソッド (28)
- ライブラリ (11)
ライブラリ
- ビルトイン (22)
-
shell
/ command-processor (6)
クラス
-
Shell
:: CommandProcessor (6) - Thread (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
add
_ trace _ func (11) - drb (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
set
_ trace _ func (11) - セキュリティモデル (11)
検索結果
先頭5件
-
Shell
:: CommandProcessor # join(*item) -> String (21107.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param item 連結したいディレクトリ名やファイル名を文字列で与えます。
@see File.join... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (294.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への変更点(まとめ)/サポートプラットフォームの追加>))
...らしい
^^;;)
: ((<Proc/Proc.new>)) [change]
: ((<組み込み関数/lambda>)) [change]
: ((<組み込み関数/proc>)) [change]
以下のように変更されました。((<ruby-dev:20358>))
* Proc.new およびブロック引数で与えられる Proc は
引数チェ......ックがゆるい。break が例外になる。
Proc.new {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 for 3) (ArgumentError)
from -:1:in `call'
from -:1
ruby 1.6.8 (2002-12-24) [i586-lin......) [compat]
ローカル側アドレスを省略可能な第3,4引数で指定できるようになりました。
=== Thread
: ((<Thread#join|Thread/join>)) [compat]
スレッドを待ち合わせる時間を limit で指定できるようになりました。
: ((<Thread/Thread.list>)) [c... -
Thread
# add _ trace _ func(pr) -> Proc (113.0) -
スレッドにトレース用ハンドラを追加します。
...加したハンドラを返します。
@param pr トレースハンドラ(Proc オブジェクト)
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
#... -
Thread
# set _ trace _ func(pr) -> Proc | nil (113.0) -
スレッドにトレース用ハンドラを設定します。
...ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:0x00007fc8de886770>......"c-return", "example.rb", 5, :current, #<Binding:0x00007fc8de9673b0>, Thread]
# => ["c-call", "example.rb", 5, :set_trace_func, #<Binding:0x00007fc8de966fc8>, Thread]
//}
@param pr トレースハンドラ(Proc オブジェクト) もしくは nil
@see Thread#add_trace_func Kernel.#set_trace_func... -
NEWS for Ruby 2
. 7 . 0 (78.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...==== ブロックなしの proc/lambda が deprecated
* ブロック付きで呼び出されたメソッドの中で、ブロックなしでProc.newやKernel#procを
呼び出すと警告が表示されるようになりました。
//emlist[][ruby]{
def foo
proc
end
foo { puts "Hello" }......#=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}
* 非推奨に関する警告を止めたい場合は、コマンドライン引数に
「-W:no-deprecated」を指定するか、コードの中で
「Warning[:deprecated] = false」
と......止められます。
* 「$,」にnil以外の値を設定すると警告が出るようになりました。 14240
nil以外の時はArray#joinで参照した時も警告が出ます。
この警告は「-W:no-deprecated」オプションで止められます。
* ヒアドキュメ... -
NEWS for Ruby 3
. 0 . 0 (60.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ror or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])......be compatible for essentially all usages and avoids blocking when using a scheduler. 16792
* Proc
* Proc#== and Proc#eql? are now defined and will return true for separate Proc instances if the procs were created from the same block. 14267
* Queue / SizedQueue
* Queue#pop, SizedQueue#pu......d and how to implement the scheduler hooks. 16786
* Fiber.blocking? tells whether the current execution context is blocking. 16786
* Thread#join invokes the scheduler hooks `block`/`unblock` in a non-blocking execution context. 16786
* Thread
* Thread.ignore_deadlock accessor has been... -
NEWS for Ruby 2
. 0 . 0 (54.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
* Kern......* ObjectSpace::WeakMap
* 弱い参照を保持するための低レベルのクラスです。
* Proc
* 非互換: Proc#== と #eql? を削除。
* Process
* 追加: Process#getsid session id を取得します(unix のみ)。
* Range
* 追加: Range#size サイズの......ld backtrace location
information. These are returned by Thread#backtrace_locations and
Kernel#caller_locations
* 非互換: Thread#join, Thread#value は対象のスレッドがメインスレッドか現在のスレッドである場合、
ThreadError を発生させます... -
ruby 1
. 6 feature (54.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...d>))
サイズが 0 で中身のあるファイル(Linux の /proc ファイルシステムでこ
のような場合があります)が File#read などで読めないバグが修正されまし
た。
p File.open("/proc/#$$/cmdline").read
=> ruby 1.6.7 (2002-03-01) [i586-li......くなりました。((<ruby-bugs-ja:PR#205>))
* ((<Enumerable/each_with_index>)) が self を返すようになった(以前は nil)
* ((<Process/Process.setpgrp>)) が返す値が不定だった。
* ((<String/ljust>)), ((<String/rjust>)), ((<String/center>)) の結果に
変化がな......$SAFE = 4
a.life -= 1
end.join
p a.life
=> ruby 1.6.4 (2001-06-04) [i586-linux]
6
=> ruby 1.6.4 (2001-08-06) [i586-linux]
-:6:in `life=': Insecure: can't modify Struct (SecurityError)
from -:3:in `join'
from -:3
: ((<String>))#rind... -
ruby 1
. 8 . 3 feature (36.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
...ようになりました。
=== 2005-09-16
: File.join [ruby] [compat]
型チェックを厳密にするようになりました。
$ ruby-1.8.2 -e 'p File.join(1, 2)'
"1/2"
$ ruby-1.8.3 -e 'p File.join(1, 2)'
-e:1:in `join': can't convert Fixnum into String (TypeError)......th = Thread.new{
$SAFE = 3
class Hoge
def foo
puts "safe level: #{$SAFE}"
end
end
}
th.join
p $SAFE
Hoge.new.foo
$ ruby-1.8.2 mthd_taint.rb
0
"safe level: 0"
$ ruby-1.8.3 mthd_taint.rb
0
mthd_taint.rb:......s
p d.entries
'
[]
$ ruby-1.8.3 -e '
d = Dir.new("/")
d.entries
p d.entries
'
[".", "..", "dev", "home", "proc", "var", "tmp", "etc", "usr", "sbin", "bin", "boot"]
=== 2005-07-11
: 正規表現 [ruby] [bug]
正規表現リテラル中で \c\\ 表記が... -
セキュリティモデル (24.0)
-
セキュリティモデル RubyにはCGI等のプログラミングを安全に行うことを助ける為に、セキュリティ 機構が備わっています。
...作られた時点での親スレッドの$SAFEの値を引き継ぐ
//emlist[][ruby]{
$SAFE = 0
th = Thread.new{
p $SAFE # => 0
$SAFE = 1
}
th.join
p $SAFE # => 0
//}
* $SAFE の値を現在の値より小さく変更する事はできない
//emlist{
$ ruby -e '$SAFE = 1; $SAFE = 0'......#truncate File#flock
および FileTest モジュールのメソッド
* IO#ioctl, IO#fcntl
* Process.fork Process.#setpgid Process.#setsid
Process.#setpriority Process.#egid= Process.#kill
* 危険なパスからの Kernel.#load
* 汚染された文字列を引数にしての......-e -r -i -I -x
//}
* setuid, setgid されたスクリプトは $SAFE = 1 以上で実行される。
* Proc はその時点でのセーフレベルを記憶する。
その Proc オブジェクトが call されると、記憶していたセーフレベルで実行される。
* 汚......行することが可
能です。
//emlist[例][ruby]{
def safe(level)
result = nil
Thread.start {
$SAFE = level
result = yield
}.join
result
end
lib = "insecure_library".taint # 外部から受け取った文字列(仮)
safe(1) { require lib } # $SAFE が 1 なので例外......す
//emlist{
$SAFE = 0
th = Thread.new do
p $SAFE # => 0
$SAFE = 1
ensure
$SAFE = 0
end
th.join
p $SAFE # => 0
//}
* $SAFE の値を現在の値より小さく変更する事もできる
//emlist{
$ ruby -e '$SAFE = 1; $SAFE = 0'
/......要があります。
//emlist{
def safe(level)
result = nil
Thread.start do
$SAFE = level
result = yield
ensure
$SAFE = 0
end.join
result
end
lib = "insecure_library".taint # 外部から受け取った文字列(仮)
safe(1) { require lib } # $SAFE が 1 なので例... -
drb (12.0)
-
分散オブジェクトプログラミングのためのライブラリです。
...トに
DRb::DRbUndumped を Module#include します。
dRuby はブロック付きのメソッド呼び出しをサポートしていますが、
Proc はマーシャリング不可能なので、ブロックの中身は
(リモート側でなく)ローカルプロセス上で実行されます。......バを起動する
DRb.start_service(SERVER_URI, FRONT_OBJECT, :safe_level => 1)
# DRb のスレッドが終了するのを待つ
DRb.thread.join
==== クライアント側コード
require 'drb/drb'
# 接続先の URI
SERVER_URI="druby://localhost:8787"
# DRbサーバを起動...