るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
27件ヒット [1-27件を表示] (0.111秒)

別のキーワード

  1. _builtin at
  2. _builtin values_at
  3. time at
  4. dbm values_at
  5. csv values_at

ライブラリ

キーワード

検索結果

RDoc::Options#root -> Pathname (54655.0)

コマンドライン引数の --root オプションで指定したディレクトリを返します。

コマンドライン引数の --root オプションで指定したディレクトリを返します。

指定されていない場合はカレントディレクトリを返します。

REXML::Attributes#each_attribute {|attribute| ... } -> () (27658.0)

各属性に対しブロックを呼び出します。

各属性に対しブロックを呼び出します。

個々の属性は REXML::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='&lt;'/>
</root>
EOS
a = doc.get_elements("/root...

REXML::Attributes#get_attribute(name) -> Attribute | nil (27658.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='...

REXML::Attributes#get_attribute_ns(namespace, name) -> REXML::Attribute | nil (27658.0)

namespace と name で特定される属性を返します。

namespace と name で特定される属性を返します。

namespace で名前空間を、 name で prefix を含まない属性名を
指定します。

指定された属性が存在しない場合は nil を返します。

XML プロセッサが prefix を置き換えてしまった場合でも、このメソッドを
使うことで属性を正しく指定することができます。

@param namespace 名前空間(URI, 文字列)
@param name 属性名(文字列)

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.ne...

Pathname#root? -> bool (27343.0)

self がルートディレクトリであれば真を返します。判断は文字列操作によっ て行われ、ファイルシステムはアクセスされません。

self がルートディレクトリであれば真を返します。判断は文字列操作によっ
て行われ、ファイルシステムはアクセスされません。

//emlist[例][ruby]{
require 'pathname'

Pathname('/').root? # => true
Pathname('/im/sure').root? # => false
//}

絞り込み条件を変える

REXML::Element#add_attribute(attr) -> () (18712.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

要素の属性を追加します。
同じ名前の属性がすでにある場合はその属性を新しい
属性で置き換えます。

引数の与えかたは2通りあります。
要素名と値の2つの文字列で渡す方法と REXML::Attribute オブジェクトを
渡す方法です。

文字列2つで指定する場合、属性値は unnormalized な文字列を渡す必要があります。

@param key 属性名(文字列)
@param value 属性値(文字列)
@param attr 属性(REXML::Attribute オブジェクト)

//emlist[][ruby]{
require 'rexml/document'
doc = ...

REXML::Element#attribute(name, namespace = nil) -> REXML::Attribute | nil (18658.0)

name で指定される属性を返します。

name で指定される属性を返します。

属性は REXML::Attribute オブジェクトの形で返します。

name は "foo:bar" のように prefix を指定することができます。

namespace で名前空間の URI を指定することで、その名前空間内で
name という属性名を持つ属性を指定できます。

指定した属性名の属性がない場合は nil を返します。

@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//emlist[][ruby]{
require 'rexml/document'

doc = R...

REXML::Element#add_attribute(key, value) -> () (18412.0)

要素の属性を追加します。 同じ名前の属性がすでにある場合はその属性を新しい 属性で置き換えます。

要素の属性を追加します。
同じ名前の属性がすでにある場合はその属性を新しい
属性で置き換えます。

引数の与えかたは2通りあります。
要素名と値の2つの文字列で渡す方法と REXML::Attribute オブジェクトを
渡す方法です。

文字列2つで指定する場合、属性値は unnormalized な文字列を渡す必要があります。

@param key 属性名(文字列)
@param value 属性値(文字列)
@param attr 属性(REXML::Attribute オブジェクト)

//emlist[][ruby]{
require 'rexml/document'
doc = ...

REXML::Element#each_element_with_attribute(key, value = nil, max = 0, name = nil) {|element| ... } -> () (18376.0)

特定の属性を持つすべての子要素を引数としてブロックを呼び出します。

特定の属性を持つすべての子要素を引数としてブロックを呼び出します。

key で指定した属性名の属性を持つ要素のみを対象とします。
value を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。

max に 0 を指定すると、max の指定は無視されます(0個ではありません)。

@param key 属性名(文字列)
@param value 属性値(文字列)
...

REXML::Element#xpath -> String (18340.0)

文書上の対象の要素にのみマッチする xpath 文字列を返します。

文書上の対象の要素にのみマッチする xpath 文字列を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/><c/></a>')
c = doc.root.elements[2] # <a> .. </a> の中の <c/> 要素
c # => <c/>
c.xpath # => "/a/c"
doc = REXML::Document.new('<a><b/><b/></a>')
b = doc.root.elements[2] # <a> .. </a> の中の2番目の <b...

絞り込み条件を変える

REXML::Attributes#delete(attribute) -> REXML::Element (9358.0)

指定した属性を取り除きます。

指定した属性を取り除きます。

attribute で取り除く属性を指定します。
文字列もしくは REXML::Attribute オブジェクトを指定します

self が属する要素(REXML::Element)を返します。

@param attribute 取り除く属性(文字列もしくは REXML::Attribute オブジェクト)

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
x...

REXML::Attributes#delete_all(name) -> [REXML::Attribute] (9358.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='&lt;'/>
</root>
EOS
a = doc.get_elem...

REXML::Attributes#to_a -> [Attribute] (9322.0)

属性の配列を返します。

属性の配列を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a x='1' y='2' z='3' />")
doc.root.attributes.to_a # => [x='1', y='2', z='3']
//}

REXML::Attributes#namespaces -> { String => String } (9076.0)

self の中で宣言されている名前空間の集合を返します。

self の中で宣言されている名前空間の集合を返します。

返り値は名前空間の prefix をキーとし、URI を値とする
Hash を返します。

//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='&lt;'/>
</root>
EOS
a = doc.ge...

REXML::Attributes#prefixes -> [String] (9076.0)

self の中で宣言されている prefix の集合を 文字列の配列で返します。

self の中で宣言されている prefix の集合を
文字列の配列で返します。

self が属する要素より上位の要素で定義されているものは含みません。

//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='&lt;'/>
</root>
EOS
a = doc...

絞り込み条件を変える

REXML::CData#to_s -> String (9076.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::CData#value -> String (9076.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#[](name) -> String | nil (9058.0)

属性名nameの属性値を返します。

属性名nameの属性値を返します。

属性値ではなく REXML::Attribute オブジェクトが必要な場合は
REXML::Attributes#get_attribute を使ってください。

nameという属性名の属性がない場合は nil を返します。

@param name 属性名(文字列)

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://exa...

REXML::Attributes#[]=(name, value) (9058.0)

指定した属性を更新します。

指定した属性を更新します。

name で属性の名前を、value で値を更新します。
既に同じ名前の属性がある場合は上書きされ、
そうでない場合は属性が追加されます。

//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='&lt;'/>
</root>
EO...

REXML::Attributes#each {|name, value| ... } -> () (9058.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://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a...

絞り込み条件を変える

REXML::Attributes#length -> Integer (9058.0)

属性の個数を返します。

属性の個数を返します。


//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='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p a.attributes.length # => 3
//}
...

REXML::Attributes#size -> Integer (9058.0)

属性の個数を返します。

属性の個数を返します。


//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='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p a.attributes.length # => 3
//}
...

REXML::Element#add_element(element, attrs = nil) -> Element (412.0)

子要素を追加します。

子要素を追加します。

element として追加する要素を指定します。
REXML::Element オブジェクトもしくは文字列を指定します。

element として REXML::Element オブジェクトを指定した場合、それが追加されます。
文字列を指定した場合は、それを要素名とする要素を追加します。

attrs に { String => String } という Hash を渡すと、
追加する要素の属性を指定できます。

子要素の最後に追加されます。

返り値は追加された要素です。

@param element 追加する要素
@param attrs 追加する要素に設定する...

REXML::Elements#each(xpath = nil) {|element| ... } -> [REXML::Elements] (376.0)

全ての子要素に対しブロックを呼び出します。

全ての子要素に対しブロックを呼び出します。

xpath を指定した場合には、その XPath 文字列に
マッチする要素に対しブロックを呼び出します。

REXML::XPath.each などとは異なり、要素以外の
テキストノードなどはすべて無視されることに注意してください。

@param xpath XPath文字列

//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a><b/><c/><d/>sean<b/><c/><d/></a>'
# <b/>,...

REXML::Elements#to_a(xpath = nil) -> [REXML::Element] (358.0)

すべての子要素の配列を返します。

すべての子要素の配列を返します。

xpath を指定した場合は、その XPath 文字列に
マッチする要素の配列を返します。

REXML::Elements#each と同様、REXML::XPath.match などと
異なり、要素以外の子ノードは無視されます。

@param xpath XPath文字列

//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
doc.root.elements.to_...

絞り込み条件を変える

REXML::Element#get_text(path = nil) -> REXML::Text | nil (340.0)

先頭のテキスト子ノードを返します。

先頭のテキスト子ノードを返します。

raw モードの設定は無視され、常に正規化されたテキストを返します。
REXML::Text#value も参照してください。

path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。

テキストノードがない場合には nil を返します。

@param path XPath文字列
@see REXML::Element#text

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this ...

REXML::Element#text(path = nil) -> String | nil (340.0)

先頭のテキスト子ノードの文字列を返します。

先頭のテキスト子ノードの文字列を返します。

テキストノードを複数保持している場合は最初のノードにしか
アクセスできないことに注意してください。

raw モードの設定は無視され、常に正規化されたテキストを返します。
REXML::Text#value も参照してください。

path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。

テキストノードがない場合には nil を返します。

@param path XPath文字列
@see REXML::Element#get_text

//emlist[][ruby]{
require 'rexml...