るりまサーチ

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

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

クラス

キーワード

検索結果

<< < ... 52 53 54 >>

Shell#out(dev = STDOUT, &block) -> () (12.0)

Shell#transact を呼び出しその結果を dev に出力します。

...に出力します。

@param dev 出力先をIO オブジェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(f...

Shell::CommandProcessor#out(dev = STDOUT, &block) -> () (12.0)

Shell#transact を呼び出しその結果を dev に出力します。

...に出力します。

@param dev 出力先をIO オブジェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(f...

Shell::Filter#out(dev = STDOUT, &block) -> () (12.0)

Shell#transact を呼び出しその結果を dev に出力します。

...に出力します。

@param dev 出力先をIO オブジェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(f...

WEBrick::HTTPResponse#body=(val) (12.0)

クライアントに返す内容(エンティティボディ)をセットします。

... IO オブジェクトで指定します。
自身が chunked であってもチャンク形式にする必要はありません。
適切にチャンク形式エンコーディングされます。

require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion...
...=> "1.1" } )
res.body = 'hoge'
print res.to_s

#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Length: 4

hoge...

fiddle (12.0)

*.dllや*.soなど、ダイナミックリンクライブラリを扱うためのライブラリです。

...bc.so.6","libm.so.6"
extern "int strlen(char*)"
end
# Note that we should not include the module M from some reason.

p M.strlen('abc') #=> 3

M.strlen を使用することで、ライブラリ関数 strlen() を使用できます。

==== 構造体を扱う

構造体も扱うことが...
..._usec"])
end

timeval = M::Timeval.malloc
e = M.gettimeofday(timeval, nil)

if e == 0
p timeval.tv_sec #=> 1173519547
end

上の例で、メモリの割り当てに M::Timeval.new ではなく
M::Timeval.malloc を使用していることに注意してください。

==== コールバッ...
...|ptr1,ptr2|
ptr1[0] <=> ptr2[0]
}
type
extern 'void qsort(void *, int, int, void *)'
end

buff = "3465721"
M.qsort(buff, buff.size, 1, M::QsortCallback)
p buff #=> "1234567"

ここで M::QsortCallback はブロックを呼ぶ Fiddle::Function オブジェクトです。...

絞り込み条件を変える

test/unit (12.0)

ユニットテストを行うためのライブラリです。

...のプロジェクトページを参照してください。

* Test::Unit - Ruby用単体テストフレームワーク: https://test-unit.github.io/

なお、2.2.0より前のtest/unit は当時バンドルしていた minitest/unit を使って再実装し
ていましたが、上記のtest/un...
...が必ず呼ばれます。

require 'test/unit'
require 'foo'

class TC_Foo < Test::Unit::TestCase
def setup
@obj = Foo.new
end

# def teardown
# end

def test_foo
assert_equal("foo", @obj.foo)
end
def test_bar
assert_equ...
...Finished in 0.022223 seconds.

1) Failure:
test_bar(TC_Foo) [test_foo.rb:16]:
<"bar"> expected but was
<"foo">.

2 tests, 2 assertions, 1 failures, 0 errors, 0 skips

test_bar だけテストしたい場合は以下のようなオプションを与...

制御構造 (12.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...めとする制御構造をクラス設計者が定義する事が出来るものです.

=== 条件分岐
====[a:if] if

//emlist[例][ruby]{
if age >= 12 then
print "adult fee\n"
else
print "child fee\n"
end
gender = if foo.gender == "male" then "male" else "female" end
//}

文法:...
...った break により
while 式の戻り値をその値にすることもできます。

==== while 修飾子

//emlist[例][ruby]{
sleep(60) while io_not_ready?
//}

文法:

式 while 式

右辺の式を評価した値が真の間、左辺を繰り返し実行します。

左辺の...
...r i,j in [[1,2], [3,4], [5,6]]
p [i,j]
end
# => [1, 2]
# [3, 4]
# [5, 6]
//}

for や each で配列要素を複数個ずつ取得しながらループすることは
できません。

//emlist[][ruby]{
for i,j in [1, 2, 3]
p [i,j]
end

# => [1, nil]
# [2, nil]
# [3, nil]

# [1,2]...
<< < ... 52 53 54 >>