るりまサーチ

最速Rubyリファレンスマニュアル検索!
84件ヒット [1-84件を表示] (0.031秒)
トップページ > クエリ:ruby[x] > クエリ:root[x] > 種類:クラス[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

REXML::Formatters::Default (49.0)

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

...][ruby]{
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<children>\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"
//}...

REXML::Formatters::Transitive (49.0)

XMLドキュメントをテキストの内容を変えずに 多少の整形を加えて出力するクラスです。

...場合は奇妙な出力結果になるでしょう。

//emlist[][ruby]{
require 'rexml/document'
require 'rexml/formatters/transitive'
doc = REXML::Document.new <<EOS
<root><children>
<grandchildren foo='bar' />
</children></root>
EOS

transitive_formatter = REXML::Formatters::Transitive.new
outpu...
...ter.write(doc, output)
output.string
# => "<root\n><children\n >\n<grandchildren foo='bar'\n />\n</children\n ></root\n>\n"
print output.string
# >> <root
# >> ><children
# >> >
# >> <grandchildren foo='bar'
# >> />
# >> </children
# >> ></root
# >> >

output = StringIO.new
transitive_f...

REXML::Comment (31.0)

XML コメントを表すクラス。

...コメントとは <!-- と --> で挟まれたテキストです。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<!-- xx -->
<root>
<!-- yy -->
text
<!-- zz -->
</root>
EOS

doc[0].string # => " xx "
doc.root[1].string # => " yy "
doc.root[3].string # => " zz "
//}...

REXML::Formatters::Pretty (31.0)

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

...トの改行や空白を修正して出力します。

//emlist[][ruby]{
require 'rexml/document'
require 'rexml/formatters/pretty'
doc = REXML::Document.new <<EOS
<root>
<children>
<grandchildren foo='bar'/>
</children>
</root>
EOS

pretty_formatter = REXML::Formatters::Pretty.new
output = Strin...
...gIO.new
pretty_formatter.write(doc, output)
output.string
# => "<root>\n <children>\n <grandchildren foo='bar'/>\n </children>\n</root>"
# この出力結果は入力のXMLよりも空白が増えている
//}...

PStore (29.0)

Rubyのオブジェクトを外部ファイルに格納するためのクラスです。 内部で Marshal を使っています。

...Rubyのオブジェクトを外部ファイルに格納するためのクラスです。
内部で Marshal を使っています。

=== 使い方

データベースにアクセスするためには、
transaction のブロック内である必要があります。
インターフェースは Hash...
...に似ています。

require 'pstore'
db = PStore.new("/tmp/foo")
db.transaction do
p db.roots # => []
ary = db["root"] = [1,2,3,4]
ary[0] = [1,1.5]
end

db.transaction do
p db["root"] # => [[1, 1.5], 2, 3, 4]
end...

絞り込み条件を変える

Psych::TreeBuilder (13.0)

YAML AST を構築するためのクラスです。

...

また、Psych::Visitors::YAMLTree.new に渡して Ruby オブジェクト
を YAML AST に変換することもできます。

=== Example

parser = Psych::Parser.new Psych::TreeBuilder.new
parser.parse('--- foo')
parser.handler.root # => #<Psych::Nodes::Stream:0x00000001400000 ... >...

REXML::Instruction (13.0)

XML 処理命令(XML Processing Instruction, XML PI)を表すクラス。

...ませんが、
似た見た目を持っています。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<root />
EOS
doc[2] # => <?p-i xml-stylesheet ...?>
doc[2].target # => "xml...