733件ヒット
[1-100件を表示]
(0.142秒)
別のキーワード
ライブラリ
クラス
- Array (35)
-
CSV
:: Table (12) - Data (6)
- Enumerator (24)
- File (12)
- Hash (196)
-
JSON
:: State (48) - MatchData (16)
- Matrix (108)
-
OpenSSL
:: ASN1 :: ASN1Data (24) - OptionParser (36)
- Prime (12)
-
REXML
:: Attribute (12) -
REXML
:: Attributes (36) -
REXML
:: CData (24) -
REXML
:: DocType (12) -
REXML
:: Element (72) - String (12)
- Struct (36)
キーワード
- [] (12)
- []= (12)
-
add
_ attribute (24) -
add
_ attributes (12) -
attributes
_ of (12) - bytebegin (2)
- byteend (2)
- coerce (12)
- configure (12)
-
delete
_ if (12) - each (36)
-
each
_ attribute (12) -
each
_ element _ with _ attribute (12) -
each
_ key (12) -
each
_ pair (24) -
each
_ value (12) - eigen (12)
- eigensystem (12)
-
fetch
_ values (22) - filter (7)
- filter! (7)
-
find
_ index (36) - flock (12)
-
get
_ text (12) - indent (12)
- indent= (12)
- index (36)
-
keep
_ if (12) - merge (12)
-
next
_ values (12) - on (36)
- pack (21)
-
peek
_ values (12) -
prime
_ division (12) - reject (12)
- reject! (12)
- select (12)
- select! (12)
- text (12)
-
to
_ h (6) -
to
_ s (12) -
to
_ string (12) -
transform
_ values (9) -
transform
_ values! (9) - unpack (12)
- value= (12)
-
values
_ at (60)
検索結果
先頭5件
-
MatchData
# values _ at(*index) -> [String] (24338.0) -
正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。
...t[例][ruby]{
m = /(foo)(bar)(baz)/.match("foobarbaz")
# same as m.to_a.values_at(...)
p m.values_at(0, 1, 2, 3, 4) # => ["foobarbaz", "foo", "bar", "baz", nil]
p m.values_at(-1, -2, -3, -4, -5) # => ["baz", "bar", "foo", nil, nil]
m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
m.t......o_a # => ["1 + 2", "1", "+", "2"]
m.values_at(:a, :b, :op) # => ["1", "2", "+"]
//}
@see Array#values_at, Array#[]... -
OpenSSL
:: ASN1 :: ASN1Data # value -> object (24224.0) -
ASN.1 値に対応するRubyのオブジェクトを返します。
...ASN.1 値に対応するRubyのオブジェクトを返します。
@see OpenSSL::ASN1::ASN1Data#value=... -
REXML
:: CData # value -> String (21220.0) -
テキスト文字列を返します。
...テキスト文字列を返します。
@see REXML::Text#value, REXML::Text#to_s
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root><![CDATA[foobar baz]]></root>
EOS
doc.root[0].class # => REXML::CData
doc.root[0].value # => "foobar baz"
//}... -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (18413.0) -
各属性に対しブロックを呼び出します。
...ML::Attribute オブジェクトで渡されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").......first
a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}... -
Array
# values _ at(*selectors) -> Array (18356.0) -
引数で指定されたインデックスに対応する要素を配列で返します。インデッ クスに対応する値がなければ nil が要素になります。
...。
@param selectors インデックスを整数もしくは整数の Range で指定します。
//emlist[例][ruby]{
ary = %w( a b c d e )
p ary.values_at( 0, 2, 4 ) #=> ["a", "c", "e"]
p ary.values_at( 3, 4, 5, 6, 35 ) #=> ["d", "e", nil, nil, nil]
p ary.values_at( 0, -1, -2 )......> ["a", "e", "d"]
p ary.values_at( -4, -5, -6, -35 ) #=> ["b", "a", nil, nil]
p ary.values_at( 1..2 ) #=> ["b", "c"]
p ary.values_at( 3..10 ) #=> ["d", "e", nil, nil, nil, nil, nil, nil]
p ary.values_at( 6..7 ) #=> [nil, nil]
p ary.values_at( 0, 3..5 ) #=... -
CSV
:: Table # values _ at(indices _ or _ headers) -> Array (18326.0) -
デフォルトのミックスモードでは、インデックスのリストを与えると行単位の 参照を行い、行の配列を返します。他の方法は列単位の参照と見なします。行 単位の参照では、返り値は行ごとの配列を要素に持つ配列です。
...つ配列です。
探索方法を変更したい場合は CSV::Table#by_col!,
CSV::Table#by_row! を使用してください。
アクセスモードを混在させることはできません。
//emlist[例 ロウモード][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row......1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table.values_at(1) # => [#<CSV::Row "header1":"row2_1" "header2":"row2_2">]
//}
//emlist[例 カラムモード][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, row2])
table.by_col!
table.values_at(1) # => [["row1_2"], ["row2_2"]]
//}
@see CSV::Table#by_col!, CSV::Table#by_row!... -
Hash
# values _ at(*keys) -> [object] (18320.0) -
引数で指定されたキーに対応する値の配列を返します。
...0 個以上指定します。
@return 引数で指定されたキーに対応する値の配列を返します。
引数が指定されなかった場合は、空の配列を返します。
//emlist[例][ruby]{
h = {1=>"a", 2=>"b", 3=>"c"}
p h.values_at(1,3,4) #=> ["a", "c"......, nil]
# [h[1], h[3] ,h[4]] と同じ
//}
@see Hash#[] , Hash.new, Hash#default, Hash#default_proc, Array#values_at... -
Struct
# values _ at(*members) -> [object] (18314.0) -
引数で指定されたメンバの値の配列を返します。
...embers Integer か Range でメンバのインデックスを指定します。
@raise IndexError member が整数で存在しないメンバを指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar, :baz)
obj = Foo.new('FOO', 'BAR', 'BAZ')
p obj.values_at(0, 1, 2......) # => ["FOO", "BAR", "BAZ"]
//}
[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。... -
Enumerator
# next _ values -> Array (15207.0) -
「次」のオブジェクトを配列で返します。
...トを配列で返します。
Enumerator#next とほぼ同様の挙動をします。終端まで到達した場合は
StopIteration 例外を発生させます。
このメソッドは、
yield
と
yield nil
を区別するために使えます。
next メソッドによる外部列挙の....../emlist[例: next と next_values の違いを][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
yield nil
yield [1, 2]
end
e = o.to_enum
p e.next_values
p e.next_values
p e.next_values
p e.next_values
p e.next_values
e = o.to_enum
p e.next
p e.next
p e.next
p e.next
p e.next
##......yield args next_values next
# yield [] nil
# yield 1 [1] 1
# yield 1, 2 [1, 2] [1, 2]
# yield nil [nil] nil
# yield [1, 2] [[1, 2]] [1, 2]
//}
@raise StopIteration 列挙状態が既に最...