るりまサーチ

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

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object send
  4. object to_enum
  5. object enum_for

ライブラリ

クラス

キーワード

検索結果

CSV::Row#field(header_or_index, minimum_index = 0) -> object | nil (15315.0)

ヘッダの名前かインデックスで値を取得します。フィールドが見つからなかった場合は nil を返します。

...ているヘッダがある場合に便利です。

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

row = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])

row.field("header1") # => "row1_1"
row.field("header2") # => "row1_2"
row["header1"] # => "row1_1"
row["header2"] # => "row1_2"
//}...

OpenStruct#delete_field(name) -> object (6302.0)

nameで指定された要素を削除します。

nameで指定された要素を削除します。

その後その要素を参照したら nil が返ります。

@param name 削除する要素を文字列かシンボルで指定します。
@return 削除前の要素の値を返します。

ruby 1.8.4 feature (474.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...e/Ruby本体>))
* ((<ruby 1.8.4 feature/Symbol [bug]>))
* ((<ruby 1.8.4 feature/Symbol [bug]>))
* ((<ruby 1.8.4 feature/super [bug]>))
* ((<ruby 1.8.4 feature/正規表現 [bug]>))
* ((<ruby 1.8.4 feature/シグナル [bug]>))
* ((<ruby 1.8.4 feature/組み込みライブラリ>))
* ((<r...
...p :"#{""}"

# => ruby 1.8.3 (2005-09-21) [i686-linux]
:
# => ruby 1.8.4 (2005-12-16) [i686-linux]
-:1: empty symbol literal

: Symbol [bug]

#Sat Oct 22 13:26:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
#
# * object.c (sym_inspect), parse.y (p...
...#: WEBrick
#Mon Oct 31 05:37:20 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
#
# * lib/webrick/httpservlet/cgihandler.rb
# (WEBrick::HTTPServlet::CGIHandler#do_GET): the value of Set-Cookie:
# header field should be splited into each cookie. [ruby-Bugs:2199]
#
# * lib/web...

CSV::Row#delete(header_or_index, minimum_index = 0) -> [object, object] | nil (308.0)

ヘッダの名前かインデックスで行からフィールドを削除するために使用します。

..., "row1_2"])

row # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
row.delete("header1")
row # => #<CSV::Row "header2":"row1_2">
//}

//emlist[例 ヘッダの index で指定][ruby]{
require "csv"

row = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])

row # => #<CSV::Row "header1"...
...>
row.delete(0)
row # => #<CSV::Row "header2":"row1_2">
//}

//emlist[例 ヘッダの名前と offset で指定][ruby]{
require "csv"

row = CSV::Row.new(["header1", "header2", "header1"], ["row1_1", "row1_2", "row1_3"])

row # => #<CSV::Row "header1":"row1_1" "header2":"row1_2" "header1":"row1_3">...
...row.delete("header1", 1)
row # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
//}

@see CSV::Row#field...

CSV::Row#[](header_or_index, minimum_index = 0) -> object | nil (215.0)

ヘッダの名前かインデックスで値を取得します。フィールドが見つからなかった場合は nil を返します。

...ているヘッダがある場合に便利です。

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

row = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])

row.field("header1") # => "row1_1"
row.field("header2") # => "row1_2"
row["header1"] # => "row1_1"
row["header2"] # => "row1_2"
//}...

絞り込み条件を変える

CSV.new(data, options = Hash.new) -> CSV (136.0)

このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。

...す。
A sequence will be selected even if it occurs in a quoted field, assuming that you
would have the same line endings there. If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object
::STDERR, or the stream is only available for output, the default...
...$INPUT_RECORD_SEPARATOR ($/) is used. Obviously,
discovery takes a little time. Set manually if speed is important. Also
note that IO objects should be opened in binary mode on Windows if this
feature will be used as the line-ending translation can cause
problems with resetting the d...
..."test.csv", users)

File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka" "age":"20">
end
//}

//emlist[例 文字列の読み込み][ruby]{
require "csv"

users =<<-EOS
id|first name|las...

ruby 1.8.3 feature (24.0)

ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))

...ruby 1.8.3 feature
*((<ruby 1.8 feature>))
*((<ruby 1.8.2 feature>))

ruby 1.8.2 から ruby 1.8.3 までの変更点です。

掲載方針

*バグ修正の影響も含めて動作が変わるものを収録する。
*単にバグを直しただけのものは収録しない。
*ライブラリ...
...y-talk:146776>)) ((<ruby-talk:146894>))
$ cat test_dlg.rb
foo = Object.new
foo2 = SimpleDelegator.new(foo)
def foo.bar
puts "bar"
end
foo2.bar

$ ruby-1.8.2 -r delegate test_dlg.rb
test_dlg.rb:6: undefined method `bar' for #<Object:0x4021b0a0> (NoMethodEr...
...: String#<=> [ruby][compat]

比較できないものを渡された時に false ではなく nil を返すようになりました。
((<ruby-dev:25811>))

$ ruby-1.8.2 -e 'p "a" <=> 1'
false
$ ruby-1.8.3 -e 'p "a" <=> 1'
nil


=== 2005-03-06
: HTTPHeader#get_fields [lib][new]...