165件ヒット
[1-100件を表示]
(0.040秒)
種類
- インスタンスメソッド (100)
- 文書 (32)
- ライブラリ (22)
- 定数 (11)
クラス
- CSV (66)
-
CSV
:: FieldInfo (33) - Range (12)
キーワード
- Converters (11)
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 1 . 0 (3) - converters (11)
- entries (6)
- header (11)
- index (11)
- line (11)
- rdoc (11)
- rss (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 9 feature (11) -
to
_ a (6) -
unconverted
_ fields? (11)
検索結果
先頭5件
-
CSV
# convert {|field , field _ info| . . . } (18217.0) -
引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別 のオブジェクトへと変換します。
...ールドを渡して文字列から別
のオブジェクトへと変換します。
引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の変換器を追加することもできま
す。
ブロックパ......換器の名前を指定します。
//emlist[例 name で Converter を指定][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.convert(:date)
csv.read # => 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)>, #<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>
//}
//emlist[......][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field
p field_info
Date.parse(field)
end
p csv.first
# => "2018-07-09"
# => <struct CSV::FieldInfo index=0, line=2, header="date1">
# => "2018-07-10"
# => #<struct CS... -
CSV
# convert {|field| . . . } (18217.0) -
引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別 のオブジェクトへと変換します。
...ールドを渡して文字列から別
のオブジェクトへと変換します。
引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の変換器を追加することもできま
す。
ブロックパ......換器の名前を指定します。
//emlist[例 name で Converter を指定][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.convert(:date)
csv.read # => 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)>, #<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>
//}
//emlist[......][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field
p field_info
Date.parse(field)
end
p csv.first
# => "2018-07-09"
# => <struct CSV::FieldInfo index=0, line=2, header="date1">
# => "2018-07-10"
# => #<struct CS... -
CSV
# convert(name) (18217.0) -
引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別 のオブジェクトへと変換します。
...ールドを渡して文字列から別
のオブジェクトへと変換します。
引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の変換器を追加することもできま
す。
ブロックパ......換器の名前を指定します。
//emlist[例 name で Converter を指定][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.convert(:date)
csv.read # => 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)>, #<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>
//}
//emlist[......][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field
p field_info
Date.parse(field)
end
p csv.first
# => "2018-07-09"
# => <struct CSV::FieldInfo index=0, line=2, header="date1">
# => "2018-07-10"
# => #<struct CS... -
CSV
# unconverted _ fields? -> bool (6160.0) -
パースした結果が unconverted_fields というメソッドを持つ場合に真を返します。 そうでない場合は、偽を返します。
...結果が unconverted_fields というメソッドを持つ場合に真を返します。
そうでない場合は、偽を返します。
//emlist[例][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.unconverted_fields? # => nil
csv = CSV.new("date1,date2\n2018-07-09......,2018-07-10", unconverted_fields: false)
csv.unconverted_fields? # => false
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true, unconverted_fields: true)
csv.unconverted_fields? # => true
csv.convert(:date)
row = csv.readline
row.fields # => [#<Date: 2018-07-09 ((2458309j......,0s,0n),+0s,2299161j)>, #<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>]
row.unconverted_fields # => ["2018-07-09", "2018-07-10"]
//}
@see CSV.new... -
CSV
:: Converters -> Hash (6130.0) -
このハッシュは名前でアクセスできる組み込みの変換器を保持しています。
...このハッシュは名前でアクセスできる組み込みの変換器を保持しています。
CSV#convert で使用する変換器として使用できます。
また CSV.new のオプションとして使用することもできます。
: :integer
Kernel.#Integer を使用してフ......: :numeric
:integer と :float の組み合わせです。
: :date
Date.parse を使用してフィールドを変換します。
: :date_time
DateTime.parse を使用してフィールドを変換します。
: :all
:date_time と :numeric の組み合わせです。
全ての組み込み... -
CSV
# converters -> Array (6118.0) -
現在の変換器のリストを返します。
...在の変換器のリストを返します。
//emlist[例][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2", converters: CSV::Converters.keys)
csv.converters # => [:integer, :float, :integer, :float, :date, :date_time, :date_time, :integer, :float]
//}
@see CSV::Converters... -
rss (192.0)
-
RSS を扱うためのライブラリです。
...ample.com/article.html"
item.title = "Sample Article"
item.date = Time.parse("2004/11/1 10:10")
end
end
サンプル中の
item.date = ...
は
item.dc_date = ...
でも構いません.#dc_date=は#date=の単なる別名で
す.
===== さらにエントリを追加......cle.html"
item.title = "Sample Article"
item.date = Time.parse("2004/11/1 10:10")
end
maker.items.new_item do |item|
item.link = "http://example.com/article2.html"
item.title = "Sample Article2"
item.date = Time.parse("2004/11/2 10:10")
end
end
===== エ......えて
扱うことにします。
def print_items(feed)
convert_to_rss10(feed).items.each do |item|
puts "#{item.title} : #{item.description}"
end
end
convert_to_rss10は以下のようになります。
def convert_to_rss10(feed)
feed.to_rss("1.0") do |maker|
maker... -
CSV
:: FieldInfo # header -> String | nil (60.0) -
利用可能な場合はヘッダを表す文字列を返します。
...sv'
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.header
Date.parse(field)
end
p csv.first
# => "date1"
# => "date2"
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)> "date2":#<Date: 2018-07-10 ((2458... -
CSV
:: FieldInfo # line -> Integer (60.0) -
行番号を返します。
...new("date1,date2,date3\n2018-07-09,2018-07-10\n2018-08-09,2018-08-10", headers: true)
csv.convert do |field,field_info|
p field_info.line
Date.parse(field)
end
p csv.to_a
# => 2
# => 2
# => 3
# => 3
# => [#<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)> "date2":#<Date: 201......8-07-10 ((2458310j,0s,0n),+0s,2299161j)> "date3":nil>, ...]
//}... -
ruby 1
. 9 feature (54.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...uby-core:07414>))
((<URL:http://www.atdot.net/~ko1/w3ml/w3ml.cgi/ruby-cvs/msg/16833>))
((<URL:http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9+update+4>))
=== 2006-05-22
: accept
((<ruby-core:7917>))
=== 2006-03-21
: MatchData#[] [compat]
名前による参照
((<ruby-dev:28446>))
==......変数
((<URL:http://www.rubyist.net/~matz/20050309.html#p03>))
=== 2005-03-04
: Time.strptime [lib][new]
: ParseDate.strptime [lib][new]
time ライブラリ, parsedate ライブラリに追加 ((<ruby-talk:132815>))
=== 2005-03-04
1.9.0 からメソッドと括弧の間にスペース....../Maker [lib] [new]
((<Imageモジュール|URL:http://web.resource.org/rss/1.0/modules/image/>))のサポート
=== 2005-02-03
: RSS::Element#convert(value) [lib] [new]
valueのエンコーディングを変換するメソッドを公開。
valueのエンコーディングは要素の...