るりまサーチ

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

クラス

検索結果

<< 1 2 3 > >>

CSV::Row#<<(arg) -> self (18236.0)

自身に与えられたデータを追加します。

...true)

row << ["header1", "row1_1"]
row << ["header2", "row1_2"]
row.to_a # => [["header1", "row1_1"], ["header2", "row1_2"]]
//}

//emlist[例 Hash を指定][ruby]{
require "csv"

row = CSV::Row.new([], [], true)

row << { "header1" => "row1_1" }
row << { "header2" => "row1_2" }
row.to_a # => [["h...

CSV::Table#<<(row_or_array) -> self (18212.0)

自身の最後に新しい行を追加します。

...mlist[例][ruby]{
require "csv"

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1])
table << row2
table.to_a # => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]
//}...

ruby 1.6 feature (5286.0)

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) -> stable-snapshot

: 2003-01-22: errno

EAGAIN と EWOULDBLOCK が同じ値の...
...upcase!
p a
=> ruby 1.6.7 (2002-03-01) [i586-linux]
"KEY"
=> -:3:in `upcase!': can't modify frozen string (TypeError)
from -:3
ruby 1.6.7 (2002-08-01) [i586-linux]

: 2002-06-10 Fixnum#>>, <<

負の数に対して右シフトすると...
...ました。
((<ruby-dev:13299>))

class X
include Enumerable

def each(&block)
block.call(1,2)
block.call(2,3)
block.call(3,4)
end
end

x = X.new
p x.to_a #=> [[1], [2], [3]]

# => ruby 1.6.3 (2001-03-19) [i586-linux]
[[1], [2...

1.6.8から1.8.0への変更点(まとめ) (2604.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...作はなくなりました)

$defout や $deferr に代入を行うと警告がでます。
(注:1.6 に $deferr はありません)
((<ruby-dev:20961>))

$stdin にオブジェクトを代入すると標準入力からの入力メソッド(gets 等)
はそのオブジェクトにメソ...
...RBOSE = nil の指定(-W0)を可能にします。

: ruby interpreter [ruby] [change]

クラスの特異クラスの特異クラスは特異クラス自身であると定義されました
((<ruby-bugs-ja:313>))。なんだかよくわかりません(^^;

class << Object
p [s...
...[change]
((<Time/Time.times>)) から移動しました。
(Time.times も残っていますが、warningが出ます)

: ((<Time#to_a|Time/to_a>)) [change]
: ((<Time#zone|Time/zone>)) [change]
gmtime なタイムゾーンに対して"UTC"を返すようになりました...

rake (192.0)

Rake というコマンドラインツールを扱うライブラリです。

...い方

$ rake --help
rake [-f rakefile] {options} targets...
Options are ...
-
C, --classic-namespace トップレベルに Task, FileTask を定義します。
過去との互換性のためのオプションです。
-
D, --describe [PATTE...
...スクを定義する例:
# coding: utf-8
require 'rake/testtask'
require 'rake/clean' # clean, clobber の二つのタスクを定義
task :default => [:test]

1.upto(8) do |n|
Rake::TestTask.new("test_step#{n}") do |t|
t.libs << "step#{n}"
t.test_files = FileList["st...
...ep#{n}/test_*.rb"]
t.verbose = false
end
end

desc 'execute all test'
task 'test_all' => (1..8).to_a.map{|n| "test_step#{n}"}

=== 用語集


: action / アクション
タスクを機能させるためのコードです。
Rakefile 内のアクションはコードブロッ...

絞り込み条件を変える

Regexp#match(str, pos = 0) -> MatchData | nil (154.0)

指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。

...foobar", 3).captures) # => ["b", "r"]
p(/(.).(.)/.match("foobar", -3).captures) # => ["b", "r"]
//}

pos を指定しても MatchData#offset 等の結果
には影響しません。つまり、
//emlist[][ruby]{
re.match(str[pos..-1])
//}

//emlist[][ruby]{
re.match(str, pos)
//}
は異なり...
...しなかった場合は nil を返します。

//emlist[例][ruby]{
results = []
/((.)\2)/.match("foo") {|m| results << m[0] } # => ["oo"]
/((.)\2)/.match("bar") {|m| results << m[0] } # => nil
results # => ["oo"]
//}

@param str 文字列を指定します。str との正規表現マッチを行...
...oobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}

=== 便利な使いかた
正規表現にマッチした部分文字列だけが必要な場合に、

//emlist[][ruby]{
bar = /foo(.*)baz/.match("foobarbaz").to_a[1]

foo, bar, baz = /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at...

Regexp#match(str, pos = 0) {|m| ... } -> object | nil (154.0)

指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。

...foobar", 3).captures) # => ["b", "r"]
p(/(.).(.)/.match("foobar", -3).captures) # => ["b", "r"]
//}

pos を指定しても MatchData#offset 等の結果
には影響しません。つまり、
//emlist[][ruby]{
re.match(str[pos..-1])
//}

//emlist[][ruby]{
re.match(str, pos)
//}
は異なり...
...しなかった場合は nil を返します。

//emlist[例][ruby]{
results = []
/((.)\2)/.match("foo") {|m| results << m[0] } # => ["oo"]
/((.)\2)/.match("bar") {|m| results << m[0] } # => nil
results # => ["oo"]
//}

@param str 文字列を指定します。str との正規表現マッチを行...
...oobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}

=== 便利な使いかた
正規表現にマッチした部分文字列だけが必要な場合に、

//emlist[][ruby]{
bar = /foo(.*)baz/.match("foobarbaz").to_a[1]

foo, bar, baz = /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at...

Array#combination(n) -> Enumerator (142.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...mbination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] :...
...た配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#combination(n) {|c| block } -> self (142.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...mbination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] :...
...た配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#permutation(n = self.length) -> Enumerator (142.0)

サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。

...3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one...
....permutation(4).to_a #=> [] : no permutations of length 4
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| result << e} # => [1,2,3]...

絞り込み条件を変える

<< 1 2 3 > >>