るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

検索結果

<< 1 2 3 ... > >>

Module#attr(*name) -> [Symbol] (30376.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

...す。

//emlist[例][ruby]{
class User
attr
:name # => [:name]
# 複数の名前を渡すこともできる
attr
:id, :age # => [:id, :age]
end
//}

このメソッドで定義されるアクセスメソッドの定義は次の通りです。

//emlist[例][ruby]{
def name
@
name
end
//}...
...が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@
name = val
end
//}

第 2 引数 に true か false を指定する方法は非推奨です。

@
param n...
...ame String または Symbol で指定します。
@
return 定義されたメソッド名を Symbol の配列で返します。...

Module#attr(name, false) -> [Symbol] (30376.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

...す。

//emlist[例][ruby]{
class User
attr
:name # => [:name]
# 複数の名前を渡すこともできる
attr
:id, :age # => [:id, :age]
end
//}

このメソッドで定義されるアクセスメソッドの定義は次の通りです。

//emlist[例][ruby]{
def name
@
name
end
//}...
...が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@
name = val
end
//}

第 2 引数 に true か false を指定する方法は非推奨です。

@
param n...
...ame String または Symbol で指定します。
@
return 定義されたメソッド名を Symbol の配列で返します。...

Module#attr(name, true) -> [Symbol] (30376.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

...す。

//emlist[例][ruby]{
class User
attr
:name # => [:name]
# 複数の名前を渡すこともできる
attr
:id, :age # => [:id, :age]
end
//}

このメソッドで定義されるアクセスメソッドの定義は次の通りです。

//emlist[例][ruby]{
def name
@
name
end
//}...
...が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@
name = val
end
//}

第 2 引数 に true か false を指定する方法は非推奨です。

@
param n...
...ame String または Symbol で指定します。
@
return 定義されたメソッド名を Symbol の配列で返します。...

Module#attr(*name) -> nil (30346.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

.../emlist[例][ruby]{
def name
@
name
end
//}

第 2 引数 が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@
name = val
end
//}

第 2 引数 に true か...
...false を指定する方法は非推奨です。

@
param name String または Symbol で指定します。...

Module#attr(name, false) -> nil (30346.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

.../emlist[例][ruby]{
def name
@
name
end
//}

第 2 引数 が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@
name = val
end
//}

第 2 引数 に true か...
...false を指定する方法は非推奨です。

@
param name String または Symbol で指定します。...

絞り込み条件を変える

Module#attr(name, true) -> nil (30346.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

.../emlist[例][ruby]{
def name
@
name
end
//}

第 2 引数 が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@
name = val
end
//}

第 2 引数 に true か...
...false を指定する方法は非推奨です。

@
param name String または Symbol で指定します。...

REXML::Attributes#get_attribute(name) -> Attribute | nil (24525.0)

name という名前の属性を取得します。

...

@
param name 属性名(文字列)
@
see REXML::Attributes#[]

//emlist[][ruby]{
r
equire '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

a.attributes.get_attribute("att") # => att='&lt;'
a.attributes.get_attribute("foo:att") # => foo:att='1'
//}...

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

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

...prefix を含まない属性名を
指定します。

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

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

@
par...
...URI, 文字列)
@
param name 属性名(文字列)

//emlist[][ruby]{
r
equire '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").fir...
...st

a.attributes.get_attribute_ns("", "att") # => att='&lt;'
a.attributes.get_attribute_ns("http://example.org/foo", "att") # => foo:att='1'
a.attributes.get_attribute_ns("http://example.org/baz", "att") # => nil
a.attributes.get_attribute_ns("http://example.org/foo", "attt") # => nil
//}...

REXML::Element#delete_attribute(key) -> REXML::Attribute | nil (21719.0)

要素から key という属性名の属性を削除します。

...

@
param key 削除する要素(文字列(属性名) or REXML::Attributeオブジェクト)

//emlist[][ruby]{
r
equire 'rexml/document'
e = REXML::Element.new("E")
e.add_attribute("x", "foo"); e # => <E x='foo'/>
e.add_attribute("y:x", "bar"); e # => <E x='foo' y:x='bar'/>
e.delete_attribute("x")...
...; e # => <E y:x='bar'/>
//}...

REXML::DocType#attribute_of(element, attribute) -> String | nil (18725.0)

DTD 内の属性リスト宣言で、 element という名前の要素の attribute という 名前の属性のデフォルト値を返します。

...DTD 内の属性リスト宣言で、 element という名前の要素の attribute という
名前の属性のデフォルト値を返します。

elementという名前の要素の属性値は宣言されていない、
elementという名前の要素にはattributeという名前の属性が宣...
...

@
param element 要素名(文字列)
@
param attribute 属性名(文字列)

//emlist[][ruby]{
r
equire 'rexml/document'

doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE books [
<!ELEMENT book (comment)>
<!ELEMENT comment (#PCDATA)>
<!ATTLIST book
author CDATA #REQUIRED
t
it...
...le CDATA #REQUIRED
publisher CDATA "foobar publisher">
]>
EOS

p doctype.attribute_of("book", "publisher") # => "foobar publisher"
p doctype.attribute_of("bar", "foo") # => nil
p doctype.attribute_of("book", "baz") # => nil
p doctype.attribute_of("book", "title") # => nil
//}...

絞り込み条件を変える

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

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

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

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

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

namespace で名前空間の URI を指定することで、その名前空間内で
name という...
...

@
param name 属性名(文字列)
@
param namespace 名前空間のURI(文字列)
//emlist[][ruby]{
r
equire '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
a.attribute("att") # => att='&lt;'
a.attribute("att", "http://example.org/bar") # => bar:att='2'
a.attribute("bar:att") # => bar:att='2'
a.attribute("baz") # => nil
//}...

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

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

...す方法と REXML::Attribute オブジェクトを
渡す方法です。

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

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

//emlist[][ruby]{
r
equire 'rexml/document'
doc = REXML::Document.new("<e/>")
doc.root.add_attribute("a", "b"); doc.root # => <e a='b'/>
doc.root.add_attribute("x:a", "c"); doc.root # => <e a='b' x:a='c'/>
doc.root.add_attribute(REXML::Attribute.new("b", "d"))
doc.root # => <e a='b' x:a='c'...
<< 1 2 3 ... > >>