るりまサーチ

最速Rubyリファレンスマニュアル検索!
55件ヒット [1-55件を表示] (0.126秒)
トップページ > クエリ:i[x] > クエリ:&[x] > クエリ:each_line[x]

別のキーワード

  1. _builtin &
  2. ipaddr &
  3. set &
  4. integer &
  5. trueclass &

ライブラリ

クラス

キーワード

検索結果

Pathname#each_line(*args) {|line| ... } -> nil (24342.0)

IO.foreach(self.to_s, *args, &block) と同じです。

...IO.foreach(self.to_s, *args, &block) と同じです。

//emlist[例][ruby]{
require "pathname"

I
O.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}

//emlist[例 ブロックを指定][ruby]{
require "pathname"

I
O.write("tes...
...tfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line {|f| p f }

# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}

//emlist[例 limit を指定][ruby]{
require "pathname"

I
O.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }

# => "line"
# => "1\n"...
...# => "line"
# => "2,\n"
# => "line"
# => "3\n"
//}

//emlist[例 sep を指定][ruby]{
require "pathname"

I
O.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(",") {|f| p f }

# => "line1\nline2,"
# => "\nline3\n"
//}

@see IO.foreach...

Pathname#each_line(*args) -> Enumerator (24242.0)

IO.foreach(self.to_s, *args, &block) と同じです。

...IO.foreach(self.to_s, *args, &block) と同じです。

//emlist[例][ruby]{
require "pathname"

I
O.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}

//emlist[例 ブロックを指定][ruby]{
require "pathname"

I
O.write("tes...
...tfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line {|f| p f }

# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}

//emlist[例 limit を指定][ruby]{
require "pathname"

I
O.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }

# => "line"
# => "1\n"...
...# => "line"
# => "2,\n"
# => "line"
# => "3\n"
//}

//emlist[例 sep を指定][ruby]{
require "pathname"

I
O.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(",") {|f| p f }

# => "line1\nline2,"
# => "\nline3\n"
//}

@see IO.foreach...

String#sum(bits = 16) -> Integer (3112.0)

文字列の bits ビットのチェックサムを計算します。

...文字列の bits ビットのチェックサムを計算します。

以下と同じです。

//emlist[][ruby]{
def sum(bits)
sum = 0
each_byte {|c| sum += c }
return 0 if sum == 0
sum & ((1 << bits) - 1)
end
//}

例えば以下のコードで UNIX System V の
sum(1) コマンドと同...
...じ値が得られます。

//emlist[例][ruby]{
sum = 0
ARGF.each_line do |line|
sum += line.sum
end
sum %= 65536
//}

@param bits チェックサムのビット数...

ruby 1.6 feature (1080.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...ruby 1.6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。

((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。

== 1.6.8 (2002-12-24) ->...
...でした。

File.symlink("foo", "bar")
p Dir.glob("bar")
=> ruby 1.6.7 (2002-03-01) [i586-linux]
[]
=> ruby 1.6.7 (2002-08-01) [i586-linux]
["bar"]

: 2002-06-13 Hash[]

Hash[] で、キーとなる文字列を dup & freeze していませ...
...7-03) [i686-linux]
0: No such file to load -- ~/a (LoadError)
$ ruby16 -v -r~/a -e0
ruby 1.6.4 (2001-07-02) [i686-linux]
0: No such file to load -- ~/a (LoadError)
$ ruby14 -v -r~/a -e0
ruby 1.4.6 (2000-08-16) [i686-linux]
"/home/nobu/a.rb"

: ((<String>))#each_line...

NEWS for Ruby 2.0.0 (42.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。

== 1.9.3 以降の変更

=== 言語仕様の変更

* キーワード引数を追加しました
* %i, %I をシンボルの配列作成のために追加しました。(%w, %W に...
...す。
//emlist{
str.lines.with_index(1) {|line, lineno| ... } # str.lines が配列を返すのでもう動かない
str.each_line.with_index(1) {|line, lineno| ... } # このように each_line に置き換える
//}

* IO#lines, IO#chars, IO#codepoints, IO#bytes, ARGF#lines, ARGF#chars,...
...e nil values. All instances
of OpenSSL::ASN1::Primitive now raise TypeError when calling to_der on an
i
nstance whose value is nil. All instances of OpenSSL::ASN1::Constructive
raise NoMethodError in the same case. Constructing such values is still
permitted.
* TLS 1.1 & 1...

絞り込み条件を変える