374件ヒット
[1-100件を表示]
(0.026秒)
ライブラリ
- ビルトイン (132)
- csv (121)
-
rexml
/ document (121)
クラス
- CSV (121)
-
REXML
:: Attributes (88) -
REXML
:: Element (33) - String (132)
キーワード
- << (11)
- [] (77)
- []= (11)
-
add
_ row (11) - attribute (11)
-
col
_ sep (11) - convert (33)
-
delete
_ all (11) - each (22)
-
each
_ attribute (11) -
get
_ attribute (11) -
get
_ attribute _ ns (11) -
header
_ convert (33) - namespaces (11)
- puts (11)
- root (11)
-
root
_ node (11) - slice (66)
検索結果
先頭5件
-
REXML
:: Attributes # namespaces -> { String => String } (6107.0) -
self の中で宣言されている名前空間の集合を返します。
...p://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
p doc.root.attributes.namespaces
# => {"foo"=>"http://example.org/foo", "bar"=>"http://example.org/bar"}
p a.attributes.namespaces
# => {}
//}... -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (242.0) -
name で指定される属性を返します。
...
name で指定される属性を返します。
属性は REXML::Attribute オブジェクトの形で返します。
name は "foo:bar" のように prefix を指定することができます。
namespace で名前空間の URI を指定することで、その名前空間内で
name という......属性名を持つ属性を指定できます。
指定した属性名の属性がない場合は nil を返します。
@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="ht......://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.attribute("att") # => att='<'
a.attribute("att", "http://example.org/bar") # => bar:att='2'
a.attribute("bar:att") # => bar:att='2'
a.attribu... -
REXML
:: Attributes # get _ attribute _ ns(namespace , name) -> REXML :: Attribute | nil (236.0) -
namespace と name で特定される属性を返します。
...namespace と name で特定される属性を返します。
namespace で名前空間を、 name で prefix を含まない属性名を
指定します。
指定された属性が存在しない場合は nil を返します。
XML プロセッサが prefix を置き換えてしまった場合......でも、このメソッドを
使うことで属性を正しく指定することができます。
@param namespace 名前空間(URI, 文字列)
@param name 属性名(文字列)
//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.get_attribute_ns("", "att") # => att='<'
a.attributes.get_attribute_ns("http://example.org/foo", "att") # => foo:att='1'
a.attributes.get_attribute_... -
CSV
# convert(name) (142.0) -
引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別 のオブジェクトへと変換します。
...引数 name で指定した変換器かブロックに各フィールドを渡して文字列から別
のオブジェクトへと変換します。
引数 name を指定した場合は、組み込みの CSV::Converters を変換器
として利用するために使います。また、独自の......ます。ブロックは変換後の値かフィールドそのものを返さな
ければなりません。
@param name 変換器の名前を指定します。
//emlist[例 name で Converter を指定][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.convert(:date)......V.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 CSV::FieldInfo index=1, line=2, he... -
REXML
:: Attributes # [](name) -> String | nil (136.0) -
属性名nameの属性値を返します。
...属性名nameの属性値を返します。
属性値ではなく REXML::Attribute オブジェクトが必要な場合は
REXML::Attributes#get_attribute を使ってください。
nameという属性名の属性がない場合は nil を返します。
@param name 属性名(文字列)
//emlis......'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
p a.attributes["att"] # => "<"
p a.attributes["bar:att"] # => "2"
//}... -
REXML
:: Attributes # get _ attribute(name) -> Attribute | nil (136.0) -
name という名前の属性を取得します。
...name という名前の属性を取得します。
name という名前を持つ属性がない場合は nil を返します。
@param name 属性名(文字列)
@see REXML::Attributes#[]
//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.get_attribute("att") # => att='<'
a.attributes.get_attribute("foo:att") # => foo:att='1'
//}... -
String
# [](regexp , name) -> String (135.0) -
正規表現 regexp の name で指定した名前付きキャプチャにマッチする最初の 部分文字列を返します。正規表現が self にマッチしなかった場合は nil を返 します。
...正規表現 regexp の name で指定した名前付きキャプチャにマッチする最初の
部分文字列を返します。正規表現が self にマッチしなかった場合は nil を返
します。
@param regexp 正規表現を指定します。
@param name 取得したい部分文......字列のパターンを示す正規表現レジスタを示す名前
@raise IndexError name に対応する括弧がない場合に発生します。
//emlist[例][ruby]{
s = "FooBar"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/] # => "FooBar"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/, "foo"] # => "Foo"
s[... -
String
# slice(regexp , name) -> String (135.0) -
正規表現 regexp の name で指定した名前付きキャプチャにマッチする最初の 部分文字列を返します。正規表現が self にマッチしなかった場合は nil を返 します。
...正規表現 regexp の name で指定した名前付きキャプチャにマッチする最初の
部分文字列を返します。正規表現が self にマッチしなかった場合は nil を返
します。
@param regexp 正規表現を指定します。
@param name 取得したい部分文......字列のパターンを示す正規表現レジスタを示す名前
@raise IndexError name に対応する括弧がない場合に発生します。
//emlist[例][ruby]{
s = "FooBar"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/] # => "FooBar"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/, "foo"] # => "Foo"
s[... -
REXML
:: Attributes # each {|name , value| . . . } -> () (132.0) -
各属性の名前と値に対しブロックを呼び出します。
...各属性の名前と値に対しブロックを呼び出します。
名前には expanded_name(REXML::Namespace#exapnded_name)が
渡されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://examp......le.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.each do |name, value|
p [name, value]
end
# => ["foo:att", "1"]
# => ["bar:att", "2"]
# => ["att", "<"]
//}... -
REXML
:: Attributes # delete _ all(name) -> [REXML :: Attribute] (130.0) -
name という名前を持つ属性をすべて削除します。
...
name という名前を持つ属性をすべて削除します。
削除された属性を配列で返します。
@param name 削除する属性の名前
//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.delete_all("att") # => [att='<']
a # => <a foo:att='1' bar:att='2'/>
//}...