1200件ヒット
[1101-1200件を表示]
(0.128秒)
ライブラリ
- ビルトイン (468)
-
cgi
/ core (24) - csv (24)
- erb (24)
-
irb
/ context (24) -
irb
/ output-method (36) -
net
/ http (96) -
net
/ pop (108) -
net
/ smtp (24) -
net
/ telnet (6) - openssl (36)
- pp (36)
- prettyprint (72)
-
rubygems
/ commands / dependency _ command (12) -
rubygems
/ requirement (12) - shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - socket (36)
- stringio (36)
- uri (24)
-
webrick
/ httpresponse (48) - zlib (36)
クラス
-
ARGF
. class (48) - Addrinfo (24)
- Array (72)
- CGI (24)
- CSV (24)
- ERB (24)
-
File
:: Stat (12) -
Gem
:: Commands :: DependencyCommand (12) -
Gem
:: Requirement (12) - IO (96)
-
IRB
:: Context (24) -
IRB
:: OutputMethod (24) -
IRB
:: StdioOutputMethod (12) - Integer (96)
- Module (12)
-
Net
:: HTTP (96) -
Net
:: POPMail (108) -
Net
:: SMTP (24) -
Net
:: Telnet (6) - Object (60)
-
OpenSSL
:: BN (12) - PrettyPrint (72)
- Range (24)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - Socket (12)
- String (24)
- StringIO (36)
-
URI
:: MailTo (24) -
WEBrick
:: HTTPResponse (48) -
Zlib
:: GzipReader (12) -
Zlib
:: GzipWriter (24)
モジュール
- Enumerable (60)
-
OpenSSL
:: Buffering (24)
キーワード
- <=> (12)
- [] (24)
- all (36)
- body= (12)
- breakable (24)
- chunk (12)
- chunked= (12)
-
close
_ write (12) - connect (12)
-
connect
_ from (24) -
content
_ length (12) -
content
_ length= (12) - cycle (36)
-
def
_ class (12) -
def
_ module (12) - downto (24)
- each (24)
-
each
_ char (36) -
each
_ entry (24) - fdatasync (12)
- fetch (36)
-
force
_ quotes? (12) - get2 (24)
- group (12)
- header (12)
-
initialize
_ copy (12) -
inplace
_ mode (12) -
inplace
_ mode= (12) -
instance
_ method (12) - mail (36)
- nest (12)
- pop (36)
- post2 (24)
-
pretty
_ print (36) -
pretty
_ print _ cycle (12) -
pretty
_ print _ inspect (12) -
print
_ dependencies (12) - printf (60)
- printn (12)
- puts (14)
- ready (12)
- reopen (24)
-
request
_ get (24) -
request
_ post (24) -
return
_ format (12) -
return
_ format= (12) -
reverse
_ each (24) - sysseek (12)
- system (18)
- text (24)
- times (24)
-
to
_ mailtext (12) -
to
_ rfc822text (12) -
to
_ s (12) - ungetc (12)
- upto (24)
- write (2)
検索結果
先頭5件
-
ARGF
. class # inplace _ mode -> String | nil (119.0) -
c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。
...ho "test" > test.txt
# $ ruby -i.bak test.rb test.txt
# $ cat test.txt # => "TEST"
# $ cat test.txt.bak # => "test"
# test.rb
ARGF.inplace_mode # => ".bak"
ARGF.each_line {|e|print e.upcase} # => "TEST"
例:
# $ echo "test" > test.txt
# $ ruby test.rb test.txt......# $ cat test.txt # => "test"
# test.rb
ARGF.inplace_mode # => nil
ARGF.each_line {|e|print e.upcase} # => "TEST"
@see d:spec/rubycmd#cmd_option, ARGF.class#inplace_mode=... -
Array
# cycle(n=nil) -> Enumerator (119.0) -
配列の全要素を n 回(nilの場合は無限に)繰り返しブロックを呼びだします。
...省略した場合は Enumerator を返します。
@param n 繰り返したい回数を整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外......の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = ["a", "b", "c"]
a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
//}... -
Enumerable
# chunk {|elt| . . . } -> Enumerator (119.0) -
要素を前から順にブロックで評価し、その結果によって 要素をチャンクに分けた(グループ化した)要素を持つ Enumerator を返します。
...素を持つ
Enumerator を返します。
ブロックの評価値が同じ値が続くものを一つのチャンクとして
取り扱います。すなわち、ブロックの評価値が一つ前と
異なる所でチャンクが区切られます。
返り値の Enumerator は各チャンク......す。
//emlist[][ruby]{
enum.chunk {|elt| key }.each {|key, ary| do_something }
//}
例として、整数列を連続する奇数/偶数に分ける例を見てみます。
「n.even?」の値が切り替わるところで区切られているのがわかるでしょう。
//emlist[例][ruby]{
[......3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5].chunk {|n|
n.even?
}.each {|even, ary|
p [even, ary]
}
# => [false, [3, 1]]
# [true, [4]]
# [false, [1, 5, 9]]
# [true, [2, 6]]
# [false, [5, 3, 5]]
//}
このメソッドは各要素が既にソートされている場合に便利です。
以下... -
Enumerable
# cycle(n=nil) -> Enumerator (119.0) -
Enumerable オブジェクトの各要素を n 回 or 無限回(n=nil)繰り返し ブロックを呼びだします。
...//emlist[例][ruby]{
a = ["a", "b", "c"]
a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
//}
ブロックを省略した場合は、n 回 or 無限回 enum の各要素を
繰り返す Enumerator を返します。
@return ブロ......ックを指定しなかった場合は、Enumerator を返します。
レシーバが空の場合は nil を返します。... -
Enumerable
# cycle(n=nil) {|obj| . . . } -> object | nil (119.0) -
Enumerable オブジェクトの各要素を n 回 or 無限回(n=nil)繰り返し ブロックを呼びだします。
...//emlist[例][ruby]{
a = ["a", "b", "c"]
a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
//}
ブロックを省略した場合は、n 回 or 無限回 enum の各要素を
繰り返す Enumerator を返します。
@return ブロ......ックを指定しなかった場合は、Enumerator を返します。
レシーバが空の場合は nil を返します。... -
Array
# reverse _ each -> Enumerator (113.0) -
各要素に対して逆順にブロックを評価します。
...て逆順にブロックを評価します。
ブロックが与えられなかった場合は、自身と reverse_each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
a = [ "a", "b", "c" ]
a.reverse_each {|x| print x, " " }
# => c b a
//}
@see Array#each... -
Array
# reverse _ each {|item| . . . } -> self (113.0) -
各要素に対して逆順にブロックを評価します。
...て逆順にブロックを評価します。
ブロックが与えられなかった場合は、自身と reverse_each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
a = [ "a", "b", "c" ]
a.reverse_each {|x| print x, " " }
# => c b a
//}
@see Array#each... -
ERB
# def _ module(methodname=& # 39;erb& # 39;) -> Module (113.0) -
変換した Ruby スクリプトをメソッドとして定義した無名のモジュールを返します。
...返します。
@param methodname メソッド名
//emlist[例][ruby]{
require 'erb'
filename = 'example.rhtml'
erb = ERB.new("test1<%= arg1 %>\ntest2<%= arg2 %>\n")
erb.filename = filename
MyModule = erb.def_module('render(arg1, arg2)')
class MyClass
include MyModule
end
print MyClass.new.rende......r('foo', 123)
# test1foo
# test2123
//}... -
IO
# each _ char -> Enumerator (113.0) -
self に含まれる文字を一文字ずつブロックに渡して評価します。
...ません。
ブロックを省略した場合は各文字について繰り返す Enumerator を返します。
@raise IOError self が読み込み用にオープンされていない場合に発生します。
f = File.new("testfile")
f.each_char {|c| print c, ' ' } #=> #<File:testfile>...