るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

キーワード

検索結果

<< 1 2 > >>

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

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

...ェクトなどで指定します。

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


使用例:
require
'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

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

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

...ェクトなどで指定します。

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


使用例:
require
'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

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

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

...ェクトなどで指定します。

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


使用例:
require
'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

Net::POP3#set_debug_output(f) -> () (6107.0)

デバッグ用の出力 f をセットします。

...f は << メソッドを持っているオブジェクトでなければなりません。

使用例:

require
'net/pop'

pop = Net::POP3.new('pop.example.com', 110)
pop.set_debug_output $stderr
pop.start('YourAccount', 'YourPassword') {
p pop.n_bytes
}

実行結果:

POP session...

URI::Generic#route_to(dst) -> URI::Generic (6107.0)

自身から dst への相対パスを返します。

...自身から dst への相対パスを返します。

@param dst URI を文字列かURIオブジェクトで与えます。

例:
require
'uri'
p URI.parse('http://example.com/').route_to('http://example.com/foo/bar.html')

#=> #<URI::Generic:0x20100198 URL:foo/bar.html>...

絞り込み条件を変える

URI::Generic#route_from(src) -> URI::Generic (3107.0)

与えられた URI を表す src からの相対パスを返します。

...rc からの相対パスを返します。

@param src 自身の相対パスを算出するための、ルートとなる Absolute URI を与えます。

例:
require
'uri'
p URI.parse('http://example.com/foo/bar.html') - 'http://example.com/'
#=> #<URI::Generic:0x20100256 URL:foo/bar.html>...

Monitor#wait_for_cond(cond, timeout) -> bool (107.0)

MonitorMixin::ConditionVariable 用の内部メソッドです。

...指定します。
@param timeout タイムアウトまでの秒数。指定しなかった場合はタイムアウトしません。

@return タイムアウトしたときは false を返します。それ以外は true を返します。

//emlist[例][ruby]{
require
'monitor'
m = Monitor.new
cv...

Monitor#wait_for_cond(cond, timeout) -> true (107.0)

MonitorMixin::ConditionVariable 用の内部メソッドです。

...onVariable を指定します。
@param timeout タイムアウトまでの秒数。指定しなかった場合はタイムアウトしません。

@return Ruby 1.9 の頃からのバグで常に true を返します。(16608)

//emlist[例][ruby]{
require
'monitor'
m = Monitor.new
cv = Thread::Con...

REXML::DocType#write(output, indent = 0, transitive = false, ie_hack = false) -> () (107.0)

output に DTD を出力します。

...output に DTD を出力します。

このメソッドは deprecated です。REXML::Formatter で
出力してください。

@param output 出力先の IO オブジェクト
@param indent インデントの深さ。指定しないでください。
@param transitive 無視されます。指定...
...でください。

//emlist[][ruby]{
require
'rexml/document'

doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book
author CDATA #REQUIRED
title CDATA #REQUIRED
publisher CDATA "foobar publ...
...isher">
<!ENTITY p "foobar publisher">
<!ENTITY % q "quzz">
]>
EOS

doctype.write(STDOUT)
# =>
# <!DOCTYPE books [
# <!ELEMENT book (comment)>
# ....
//}...

Array#pack(template) -> String (19.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0, 256,...
..."CxC") # => "a\x00b"
[97, 98].pack("Cx3C") # => "a\x00\x00\x00b"

"abc".unpack("CxC") # => [97, 99]
"abc".unpack("Cx3C") # => ArgumentError: x outside of string
//}

: X

1バイト後退
//emlist[][ruby]{
[97, 98, 99].pack("CCXC") # => "ac"

"abcdef".unpack("x*XC") # => [102]
//}

: @...
...ong(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}

: IPアドレス
//emlist[][ruby]{
require
'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| addre...

絞り込み条件を変える

Array#pack(template, buffer: String.new) -> String (19.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...7fffffff].pack("U") # => "\xFD\xBF\xBF\xBF\xBF\xBF"
[0x80000000].pack("U") # => RangeError: pack(U): value out of range
[0,256,65536].pack("U3").b # => "\x00\xC4\x80\xF0\x90\x80\x80"

"\x00\xC4\x80\xF0\x90\x80\x80".unpack("U3") # => [0, 256,...
..."CxC") # => "a\x00b"
[97, 98].pack("Cx3C") # => "a\x00\x00\x00b"

"abc".unpack("CxC") # => [97, 99]
"abc".unpack("Cx3C") # => ArgumentError: x outside of string
//}

: X

1バイト後退
//emlist[][ruby]{
[97, 98, 99].pack("CCXC") # => "ac"

"abcdef".unpack("x*XC") # => [102]
//}

: @...
...ong(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}

: IPアドレス
//emlist[][ruby]{
require
'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| addre...

Shell::Filter#>(to) -> self (19.0)

toをフィルタの出力とする。 toが, 文字列ならばファイルに, IOオブジェクトであれ ばそれをそのまま出力とする。

...ルに,IOオブジェクトならばそれに出力します。

使用例
require
'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") > File.open("tail.out", "w")
#(sh.tail("-n 3") < "/etc/passwd") > "tail.out" # と同じ.
}...

Shell::Filter#>>(to) -> self (19.0)

toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。

...IOオブジェクトならばそれに出力します。

使用例
require
'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open("tail.out", "w") # でも同じ。
}...
<< 1 2 > >>