ライブラリ
- ビルトイン (146)
- csv (48)
- erb (12)
-
fiddle
/ import (12) -
irb
/ input-method (60) -
net
/ imap (12) - readline (12)
- socket (12)
- zlib (204)
クラス
-
ARGF
. class (24) - CSV (48)
-
Encoding
:: Converter (36) - IO (20)
-
IRB
:: InputMethod (12) -
IRB
:: ReadlineInputMethod (24) -
IRB
:: StdioInputMethod (24) - MatchData (6)
-
Net
:: IMAP (12) -
Zlib
:: GzipReader (204)
モジュール
-
Fiddle
:: Importer (12) - Kernel (48)
- Readline (12)
キーワード
-
$ _ (12) -
$ stdin (12) - EOFError (12)
- ERB (12)
- Rubyの起動 (12)
- TCPServer (12)
- append (12)
- byteoffset (6)
- each (24)
-
each
_ byte (24) -
each
_ line (24) - eof? (36)
- getc (12)
- gets (24)
- irb (12)
- lineno (12)
- lineno= (12)
- open (48)
- pread (8)
-
primitive
_ convert (36) -
rake
/ gempackagetask (12) - read (12)
-
readable
_ atfer _ eof? (36) - readbyte (24)
- readchar (24)
- readline (36)
- readlines (12)
-
ruby 1
. 8 . 4 feature (12) - sizeof (12)
- ungetc (12)
- 制御構造 (12)
検索結果
先頭5件
-
Net
:: IMAP # append(mailbox , message , flags = nil , date _ time = nil) -> Net :: IMAP :: TaggedResponse (6112.0) -
APPEND コマンドを送ってメッセージをメールボックスの末尾に追加します。
...APPEND コマンドを送ってメッセージをメールボックスの末尾に追加します。
例:
imap.append("inbox", <<EOF.gsub(/\n/, "\r\n"), [:Seen], Time.now)
Subject: hello
From: someone@example.com
To: somebody@example.com
hello world
EOF
@param mailbox メッセー... -
Fiddle
:: Importer # sizeof(t) -> Integer (6106.0) -
C における sizeof(t) の値を返します。
...C における sizeof(t) の値を返します。
t が文字列の場合、その文字列が表す C の型の size が返されます。
例えば、sizeof("char") は 1 を返します。
sizeof("char*") は環境によって 4 や 8 といった値を返します。
Fiddle::Importer#struct......ている型を Fiddle が知らなかった
場合に発生します
例:
require 'fiddle/import'
module M
extend Fiddle::Importer
Timeval = struct(["long tv_sec", "long tv_usec"])
p sizeof("char") # => 1
p sizeof("void*") # => 8
p sizeof(Timeval) # => 16
end... -
EOFError (6032.0)
-
EOF(End Of File)に達したときに発生します。
...EOF(End Of File)に達したときに発生します。... -
制御構造 (448.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...* until
* for
* break
* next
* redo
* retry
例外処理:
* raise
* begin
その他:
* return
* BEGIN
* END
Rubyでは(Cなどとは異なり)制御構造は式であって、何らかの値を返すものが
あります(返さないものもありま......\n"
else
print "child fee\n"
end
gender = if foo.gender == "male" then "male" else "female" end
//}
文法:
if 式 [then]
式 ...
[elsif 式 [then]
式 ... ]
...
[else
式 ... ]
end
条件式を評価した結......response()
end while res == 'Continue'
//}
while 修飾した式は nil を返します。
また、引数を伴った break により while 修飾した式の戻り値を
その値にすることもできます。
====[a:until] until
//emlist[例][ruby]{
until f.eof?
print f.gets
end
//}
文... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (112.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定......x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}
不正なバイトや変換先で未定義なバイトをエスケープしつつ変換する例です。以上のように... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (112.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定......x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}
不正なバイトや変換先で未定義なバイトをエスケープしつつ変換する例です。以上のように... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (112.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定......x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}
不正なバイトや変換先で未定義なバイトをエスケープしつつ変換する例です。以上のように... -
ruby 1
. 8 . 4 feature (66.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...適合する文字列を厳密にした。((<ruby-core:03573>)),((<ruby-dev:27478>))
1) alias :"foo" :"bar"
def bar; p "bar"; end
alias :"foo" :"bar"
foo
# => ruby 1.8.4 (2005-12-22) [i686-linux]
-:2: syntax error, unexpecte......"$- "
2631438
# => ruby 1.8.4 (2005-12-22) [i686-linux]
-:2: syntax error, unexpected '(', expecting $end
#Tue Nov 1 14:20:11 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
#
# * eval.c (rb_call_super): should call method_missing if super is
#......05 Guy Decoux <ts@moulon.inra.fr>
#
# * re.c (KR_REHASH): should cast to unsigned for 64bit CPU.
# [ruby-core:06721]
sizeof(long) > sizeof(int) な環境で、ハッシュ関数のオーバー
フローのためにStringをキーとしたHashの検索が失敗していたバ... -
Readline
. # readline(prompt = "" , add _ hist = false) -> String | nil (58.0) -
prompt を出力し、ユーザからのキー入力を待ちます。 エンターキーの押下などでユーザが文字列を入力し終えると、 入力した文字列を返します。 このとき、add_hist が true であれば、入力した文字列を入力履歴に追加します。 何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、 ユーザからの入力がない場合は nil を返します。
...。
このとき、add_hist が true であれば、入力した文字列を入力履歴に追加します。
何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、
ユーザからの入力がない場合は nil を返します。
本メソッドはスレッドに対......buf
end
rescue Interrupt
system("stty", stty_save)
exit
end
例: INTシグナルを捕捉して、端末状態を復帰する。
require 'readline'
stty_save = `stty -g`.chomp
trap("INT") { system "stty", stty_save; exit }
while buf = Readline.readline
p buf
end......た、単に ^C を無視する方法もあります。
require 'readline'
trap("INT", "SIG_IGN")
while buf = Readline.readline
p buf
end
入力履歴 Readline::HISTORY を使用して、次のようなこともできます。
例: 空行や直前の入力と同じ内容は入力履... -
TCPServer (48.0)
-
TCP/IP ストリーム型接続のサーバ側のソケットのクラスです。
...t)
print(s, " is accepted\n")
else
if s.eof?
print(s, " is gone\n")
s.close
socks.delete(s)
else
str = s.gets
s.write(str)
end
end
end
end
Thread を使えばもっと短くなります。
require......addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(":"))
while true
Thread.start(gs.accept) do |s| # save to dynamic variable
print(s, " is accepted\n")
while s.gets
s.write($_)
end
print(s, " is gone\n")
s.close
end
end...