るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

検索結果

<< 1 2 3 ... > >>

Matrix#element(i, j) -> () (24214.0)

(i,j)要素を返します。 行列の範囲外の値を指定した場合には nil を返します。

...には nil を返します。

@param i 要素の行成分を0オリジンで指定します。
@param j 要素の列成分を0オリジンで指定します。



//emlist[例][ruby]{
r
equire 'matrix'

a1 = [1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, 2, 1.5]
m = Matrix[a1, a2, a3]

p m[0, 0] # => 1
p m[1...

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

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

...と、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。

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

@param key 属性名(文字列)
@param value 属性値(文字列)
@param max ブロッ...
...個数
@param name xpath文字列

//emlist[][ruby]{
r
equire 'rexml/document'
doc = REXML::Document.new("<a><b id='1'/><c id='2'/><d id='1'/><e/></a>")
doc.root.each_element_with_attribute('id'){|e| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '...
...1'){|e| p e }
# >> <b id='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1', 0, 'd'){|e| p e }
# >> <d id='1'/>
//}...

Vector#elements_to_r -> Vector (21426.0)

ベクトルの各成分をRationalに変換したベクトルを返します。

...クトルの各成分をRationalに変換したベクトルを返します。

このメソッドは deprecated です。 map(&:to_r) を使ってください。

//emlist[例][ruby]{
r
equire 'matrix'

v = Vector.elements([2.5, 3.0, 5.75, 7])
p v.elements_to_r
# => Vector[(5/2), (3/1), (23/4), (7/1)...

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

子要素を追加します。

...子要素を追加します。

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

element
として REXML::Element オブジェクトを指定した場合、それが追加されます。
文字列を指定した場...
...attrs に { String => String } という Hash を渡すと、
追加する要素の属性を指定できます。

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

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

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

//emlist[...
...][ruby]{
r
equire 'rexml/document'
doc = REXML::Document.new('<a/>')
el = doc.root.add_element 'my-tag' # => <my-tag/>
doc.root.to_s # => "<a><my-tag/></a>"
el = doc.root.add_element 'my-tag', {'attr1'=>'val1', 'attr2'=>'val2'}
# => <my-tag attr1='val1' attr2='val2'/>
doc.root.to_s # => "<a><my-tag/>...

REXML::Element#delete_element(element) -> REXML::Element (18576.0)

子要素を削除します。

...

element
で削除する要素を指定できます。整数、文字列、REXML::Element
オブジェクトのいずれかが指定できます。

R
EXML::Element を指定すると、その要素が削除されます。
整数を指定すると、element 番目の要素を削除します(1-origin...
...すると、XPath としてマッチする要素を削除します。
複数の要素がマッチする場合はそのうち1つが削除されます。

@param element 削除する要素
@see REXML::Elements#delete

//emlist[][ruby]{
r
equire 'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c...
...oc.delete_element("/a/b")
doc.to_s # => "<a><c/><c id='1'/><d/><c/></a>"
doc.delete_element("a/c[@id='1']")
doc.to_s # => "<a><c/><d/><c/></a>"
doc.root.delete_element("c")
doc.to_s # => "<a><d/><c/></a>"
doc.root.delete_element("c")
doc.to_s # => "<a><d/></a>"
doc.root.delete_element(1)
doc.to_s #...

絞り込み条件を変える

REXML::Element#delete_attribute(key) -> REXML::Attribute | nil (18519.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'/>
//}...

Module#ruby2_keywords(method_name, ...) -> nil (18495.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments...
...argument is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through th...
...ethod to
other methods.

T
his should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

T
his method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby...

REXML::Element#each_element_with_text(text = nil, max = 0, name = nil) {|element| ... } -> () (18339.0)

テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。

...クを呼び出します。

t
ext を指定すると、テキストの内容が text であるもののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name を指定すると、それは xpath 文字列と見なされ、...
...)。

@param text テキストの中身(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列

//emlist[][ruby]{
r
equire 'rexml/document'
doc = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
doc.root.each_element_with_text {|e|p e}
#...
...>> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >> <c> ... </>
doc.root.each_element_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ... </>
//}...

REXML::Element#next_element -> Element | nil (18327.0)

次の兄弟要素を返します。

...次の兄弟要素を返します。

次の要素が存在しない場合は nil を返します。

//emlist[][ruby]{
r
equire 'rexml/document'
doc = REXML::Document.new '<a><b/>text<c/></a>'
doc.root.elements['b'].next_element # => <c/>
doc.root.elements['c'].next_element # => nil
//}...
<< 1 2 3 ... > >>