るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

検索結果

<< 1 2 3 ... > >>

REXML::Element#root -> REXML::Element (18155.0)

self が属する文書のルート要素を返します。

...list[][ruby]{
require
'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS

children = doc.get_elements("/root/children").first
children.name # => "children"
children.root.name # => "root"
grandchildren = doc.get_elements("/root/children/gra...
...ndchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root.name # => "root"
//}...

REXML::Element#root_node -> REXML::Document | REXML::Node (6143.0)

self が属する文書のルートノードを返します。

...st[][ruby]{
require
'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS

children = doc.get_elements("/root/children").first
children.name # => "children"
children.root_node == doc # => true
grandchildren = doc.get_elements("/root/children/...
...grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root_node == doc # => true
//}...

Pathname#root? -> bool (6119.0)

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

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

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

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

FileUtils.#cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false) (125.0)

src へのハードリンク dest を作成します。 src がディレクトリの場合、再帰的にリンクします。 dest がディレクトリの場合、src へのハードリンク dest/src を作成します。

...列で指定します。

@param dest リンク作成先のファイルかディレクトリです。

@param options :noop, :verbose, :dereference_root, :remove_destination が指定できます。
c:FileUtils#options

@raise ArgumentError dest が src に含まれる場合に発生...
...ruby にインストールする例][ruby]{
require
'fileutils'
FileUtils.rm_r site_ruby + '/mylib', force: true
FileUtils.cp_lr 'lib/', site_ruby + '/mylib'
//}

//emlist[様々なファイルを対象ディレクトリにリンクする例][ruby]{
require
'fileutils'
FileUtils.cp_lr %w(mail.rb fie...
...+ '/tmail'
FileUtils.cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', noop: true, verbose: true
//}

//emlist[内容をリンクする例][ruby]{
require
'fileutils'
# ディレクトリそのものではなく、ディレクトリの内容をリンクしたい場合は、
# 以下のようにな...

rexml/parsers/sax2parser (102.0)

SAX2 と同等の API を持つストリーム式の XML パーサ。

...パーサよりは高機能です。

//emlist[][ruby]{
require
'rexml/parsers/sax2parser'
require
'rexml/sax2listener'

parser = REXML::Parsers::SAX2Parser.new(<<XML)
<root n="0">
<a n="1">111</a>
<b n="2">222</b>
<a n="3">333</a>
</root>
XML

elements = []
parser.listen(:start_element){|uri,...
...parser.parse
elements # => [["root", {"n"=>"0"}], ["a", {"n"=>"1"}], ["b", {"n"=>"2"}], ["a", {"n"=>"3"}]]
as # => [["a", {"n"=>"1"}], ["a", {"n"=>"3"}]]
texts # => ["111", "333"]
//}

//emlist[仕様確認サンプル][ruby]{
require
'rexml/parsers/sax2parser'
require
'rexml/sax2listener'

xml = <...
...n="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<!DOCTYPE root SYSTEM "foo" [
<!ELEMENT root (a+)>
<!ELEMENT a>
<!ENTITY bar "barbarbarbar">
<!ATTLIST a att CDATA #REQUIRED xyz CDATA "foobar">
<!NOTATION foobar SYSTEM "http://example.org/foobar.dtd">
<!ENT...

絞り込み条件を変える

rexml/parsers/streamparser (84.0)

ストリーム式の XML パーサ。

...ています。
空白や改行もテキストであることに注意してください。

//emlist[][ruby]{
require
'rexml/parsers/baseparser'
require
'rexml/parsers/streamparser'
require
'rexml/streamlistener'
class Listener
include REXML::StreamListener
def initialize
@events = []
end...
...

//emlist[][ruby]{
require
'rexml/parsers/baseparser'
require
'rexml/parsers/streamparser'
require
'rexml/streamlistener'

xml = <<EOS
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<!DOCTYPE root SYSTEM "foo" [
<!ELEMENT root (a+)>
<!ELEMENT a>...
..."barbarbarbar">
<!ATTLIST a att CDATA #REQUIRED xyz CDATA "foobar">
<!NOTATION foobar SYSTEM "http://example.org/foobar.dtd">
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
]>
<root xmlns:foo="http://example.org/foo"...

REXML::CData.new(text, respect_whitespace = true, parent = nil) -> REXML::CData (60.0)

text をテキストとして持つ CData オブジェクトを生成します。

...ruby]{
require
'rexml/document'
doc = REXML::Document.new(<<EOS)
<root />
EOS
doc.root.add(REXML::CData.new("foo bar baz "))
doc.to_s # => "<root><![CDATA[foo bar baz ]]></root>\n"

doc = REXML::Document.new(<<EOS)
<root />
EOS
doc.root.add(REXML::CData.new("foo bar baz ", true))
doc.root.add(R...
...EXML::CData.new("foo bar baz ", false))
doc.to_s # => "<root><![CDATA[foo bar baz ]]><![CDATA[foo bar baz ]]></root>\n"
//}...

REXML::Elements#delete(element) -> Element (54.0)

element で指定した子要素を取り除きます。

...[][ruby]{
require
'rexml/document'
doc = REXML::Document.new '<a><b/><c/><c id="1"/></a>'
b = doc.root.elements[1]
doc.root.elements.delete b # => <b/>
doc.root.to_s # => "<a><c/><c id='1'/></a>"
doc.elements.delete("a/c[@id='1']") # => <c id='1'/>
doc.root.to_s...
...# => "<a><c/></a>"
doc.root.elements.delete 1 # => <c/>
doc.root.to_s # => "<a/>"
doc.root.elements.delete '/a'
doc.root.to_s # => ""
//}...

REXML::Formatters::Default (54.0)

XMLドキュメントを(文字列として)出力するクラスです。

...uby]{
require
'rexml/document'
require
'rexml/formatters/default'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren/>
</children>
</root>
EOS

default_formatter = REXML::Formatters::Default.new
output = StringIO.new
default_formatter.write(doc, output)
output.string
# => "<root>\n<c...
...hildren>\n <grandchildren/>\n</children>\n</root>\n"

output = StringIO.new
default_formatter.write(REXML::XPath.first(doc, "/root/children"), output)
output.string
# => "<children>\n <grandchildren/>\n</children>"

ie_hack_formatter = REXML::Formatters::Default.new(true)
output = StringIO.new
ie_...
...hack_formatter.write(doc, output)
output.string
# => "<root>\n<children>\n <grandchildren />\n</children>\n</root>\n"
//}...
<< 1 2 3 ... > >>