別のキーワード
ライブラリ
- ビルトイン (160)
- matrix (128)
-
rexml
/ document (516) - set (14)
クラス
- Array (60)
- Matrix (64)
- Module (12)
- Proc (6)
-
REXML
:: Attribute (36) -
REXML
:: Attributes (12) -
REXML
:: Child (24) -
REXML
:: DocType (48) -
REXML
:: Element (276) -
REXML
:: Elements (108) -
REXML
:: Text (12) - Range (4)
- Set (20)
- Vector (64)
モジュール
- Enumerable (72)
キーワード
- << (12)
- [] (24)
- []= (12)
- add (12)
-
add
_ attribute (24) -
add
_ attributes (12) -
add
_ element (12) -
add
_ namespace (24) - attribute (12)
-
attribute
_ of (12) -
attributes
_ of (12) - collect! (28)
- component (12)
- delete (24)
-
delete
_ all (12) -
delete
_ attribute (12) -
delete
_ element (12) -
delete
_ namespace (12) -
drop
_ while (48) - each (12)
-
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) -
elements
_ to _ f (12) -
elements
_ to _ i (12) -
elements
_ to _ r (12) -
external
_ id (12) -
get
_ text (12) -
has
_ elements? (12) - inspect (12)
- map! (28)
- namespace (24)
- namespaces (12)
-
next
_ element (12) -
next
_ sibling= (12) - prefix (12)
- prefixes (12)
-
previous
_ sibling= (12) -
reverse
_ each (28) - root (12)
-
root
_ node (12) -
ruby2
_ keywords (18) - size (12)
-
take
_ while (48) - text (12)
- text= (12)
-
to
_ a (12) -
to
_ s (8) -
to
_ string (12) - transpose (12)
- value= (12)
- write (12)
- xpath (12)
検索結果
先頭5件
-
Matrix
# element(i , j) -> () (18108.0) -
(i,j)要素を返します。 行列の範囲外の値を指定した場合には nil を返します。
...には nil を返します。
@param i 要素の行成分を0オリジンで指定します。
@param j 要素の列成分を0オリジンで指定します。
//emlist[例][ruby]{
require '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| . . . } -> () (15333.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...。
@param key 属性名(文字列)
@param value 属性値(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b id='1'/><c id='2'/><d id='1'/><e/></a>")
doc.root.eac......ment_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',... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (12470.0) -
子要素を追加します。
...子要素を追加します。
element として追加する要素を指定します。
REXML::Element オブジェクトもしくは文字列を指定します。
element として REXML::Element オブジェクトを指定した場合、それが追加されます。
文字列を指定した場......rs に { String => String } という Hash を渡すと、
追加する要素の属性を指定できます。
子要素の最後に追加されます。
返り値は追加された要素です。
@param element 追加する要素
@param attrs 追加する要素に設定する属性
//emlist[][r......uby]{
require '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/><my... -
REXML
:: Element # delete _ element(element) -> REXML :: Element (12470.0) -
子要素を削除します。
...
element で削除する要素を指定できます。整数、文字列、REXML::Element
オブジェクトのいずれかが指定できます。
REXML::Element を指定すると、その要素が削除されます。
整数を指定すると、element 番目の要素を削除します(1-origin......されます。
@param element 削除する要素
@see REXML::Elements#delete
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c id="1"/><d/><c/></a>'
doc.delete_element("/a/b")
doc.to_s # => "<a><c/><c id='1'/><d/><c/></a>"
doc.delete_element("a/c[@id='1']")
doc.t......o_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 # => "<a/>"
//}... -
Vector
# elements _ to _ r -> Vector (12320.0) -
ベクトルの各成分をRationalに変換したベクトルを返します。
...クトルの各成分をRationalに変換したベクトルを返します。
このメソッドは deprecated です。 map(&:to_r) を使ってください。
//emlist[例][ruby]{
require '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)... -
Module
# ruby2 _ keywords(method _ name , . . . ) -> nil (12264.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 argument......ash 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......other methods.
This should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.
This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby version... -
Proc
# ruby2 _ keywords -> proc (12264.0) -
Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc 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 proc to other methods.
...Marks the proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked......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 proc to other methods.
This should only be used for procs t......keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.
This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before cal... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (12233.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...せん)。
@param text テキストの中身(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列
//emlist[][ruby]{
require '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 (12221.0) -
次の兄弟要素を返します。
...次の兄弟要素を返します。
次の要素が存在しない場合は nil を返します。
//emlist[][ruby]{
require '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
//}...