171件ヒット
[1-100件を表示]
(0.201秒)
種類
- インスタンスメソッド (83)
- ライブラリ (33)
- 特異メソッド (33)
- 文書 (22)
ライブラリ
- ビルトイン (66)
-
rexml
/ document (33) -
rexml
/ streamlistener (11) -
shell
/ filter (6)
クラス
-
REXML
:: Element (22) -
REXML
:: XPath (11) -
RubyVM
:: InstructionSequence (66) -
Shell
:: Filter (6)
モジュール
キーワード
-
absolute
_ path (11) -
base
_ label (11) - compile (11)
- each (11)
-
each
_ element _ with _ attribute (11) -
each
_ element _ with _ text (11) - entitydecl (11)
- label (11)
- new (11)
- path (11)
-
rexml
/ document (11) -
rexml
/ parsers / streamparser (11) -
rexml
/ parsers / ultralightparser (11) -
ruby 1
. 6 feature (11) - 演算子式 (11)
検索結果
先頭5件
-
Shell
:: Filter # >>(to) -> self (24324.0) -
toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。
...
toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば
それをそのまま出力とする。
@param to 出力先を指定します。文字列ならばファイルに、IOオブジェクトならばそれに出力します。
使用例
r......equire 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open("tail.out", "w") # でも同じ。
}... -
rexml
/ parsers / streamparser (18210.0) -
ストリーム式の XML パーサ。
...ストリーム式の XML パーサ。
rexml の XML パーサの中では高速ですが、機能は限定的です。
もう少し高機能なストリーム式パーサが必要な場合は
REXML::Parsers::SAX2Parser を用いてください。
パーサからはコールバックによって......受け取ります。
REXML::StreamListener を include し、
必要なメソッドをオーバーライドしたクラスのオブジェクトを
コールバックオブジェクトとして REXML::Parsers::StreamParser.new
に渡します。
REXML::Parsers::StreamParser#parse を呼び出すと......t[][ruby]{
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
class Listener
include REXML::StreamListener
def initialize
@events = []
end
def text(text)
@events << "text[#{text}]"
end
def tag_start(name, attrs)
@events <<... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (12384.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...と、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。
max に 0 を指定すると、max の指定は無視されます(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.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'/>
//}... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (12312.0) -
self が表す命令シーケンスの絶対パスを返します。
...irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, wor......ld"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"
@see RubyVM::InstructionSequence#path... -
RubyVM
:: InstructionSequence # path -> String (12312.0) -
self が表す命令シーケンスの相対パスを返します。
..."<compiled>" を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/meth......od.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"
@see RubyVM::InstructionSequence#absolute_path... -
REXML
:: StreamListener # entitydecl(content) -> () (12290.0) -
DTDの実体宣言をパースしたときに呼び出されるコールバックメソッドです。
...DTDの実体宣言をパースしたときに呼び出されるコールバックメソッドです。
@param content 実体宣言が配列で渡されます
実体宣言の書き方によって content に渡されるデータの形式が異なります。
//emlist[][ruby]{
require 'rexml/parser......rser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
xml = <<EOS
<!DOCTYPE root [
<!ENTITY % YN '"Yes"'>
<!ENTITY % YN 'Yes'>
<!ENTITY WhatHeSaid "He said %YN;">
<!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY open-hatch PUBLIC "-//Text......ate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
]>
<root />
EOS
class Listener
include REXML::StreamListener
def entitydecl(content); p content; end
end
REXML::Parsers::StreamParser.new(xml, Listener.new).parse
# >>... -
rexml
/ document (12198.0) -
DOM スタイルの XML パーサ。
...
REXML::Document.new で XML 文書から DOM ツリーを
構築し、ツリーのノードの各メソッドで文書の内容にアクセスします。
以下のプログラムではブックマークの XML からデータを取り出します。
//emlist[][ruby]{
require 'rexml/document'
re......re 'pp'
Bookmark = Struct.new(:href, :title, :desc)
doc = REXML::Document.new(<<XML)
<?xml version="1.0" encoding="UTF-8" ?>
<xbel version="1.0">
<bookmark href="http://www.ruby-lang.org/ja/">
<title>オブジェクト指向スクリプト言語 Ruby</title>
<desc>Rubyの公式サイト<......ark|
href = bookmark.attribute("href").value
title_element = bookmark.elements["title"]
title = title_element ? title_element.text : nil
desc_element = bookmark.elements["desc"]
desc = desc_element ? desc_element.text : nil
Bookmark.new(href, title, desc)
end
pp bookmarks
# >> [#<struct... -
rexml
/ parsers / ultralightparser (12102.0) -
パース結果を配列で作られた木構造により返すパーサ。
...より返すパーサ。
REXML::Parsers::UltraLightParser.new でパーサオブジェクトを
生成し、REXML::Parsers::UltraLightParser#parse でパースし
その結果の木構造を返します。
===[a:nodes] ノードの表現
REXML::Parsers::UltraLightParser#parse が返す
XML の各......: [:start_element, 親ノード, 要素名, 属性, *子ノード]
XML要素。属性は { 属性名文字列 => 属性値文字列 } という Hash。
子ノードの配列は node[4..-1] で得られる。
: [:text, 正規化文字列]
テキストノード
: [:processing_instruction, タ......st[][ruby]{
require 'rexml/parsers/ultralightparser'
require 'pp'
parser = REXML::Parsers::UltraLightParser.new(<<XML)
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<a n="1">xyz</a>
<b m="2" />
</root>
XML
pp parser.parse
# >> [[:xmldecl, "1.0", "UTF-8", nil],
# >> [:text, "\n"],
# >> [:start... -
ruby 1
. 6 feature (11532.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...ruby 1.6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。
((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。
== 1.6.8 (2002-12-24) ->......stable-snapshot
: 2003-01-22: errno
EAGAIN と EWOULDBLOCK が同じ値のシステムで、EWOULDBLOCK がなくなっ
ていました。現在は、このようなシステムでは、EWOULDBLOCK は、EAGAIN
として定義されています。(これは 1.6.7 とは異なる挙.......keys[0].upcase!
p a
=> ruby 1.6.7 (2002-03-01) [i586-linux]
"KEY"
=> -:3:in `upcase!': can't modify frozen string (TypeError)
from -:3
ruby 1.6.7 (2002-08-01) [i586-linux]
: 2002-06-10 Fixnum#>>, <<
負の数に対して右シフト... -
RubyVM
:: InstructionSequence # base _ label -> String (9312.0) -
self が表す命令シーケンスの基本ラベルを返します。
...1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "he......, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label # => "<main>"
例3:
# /tmp/method2.rb
def hello
puts "hello, world"
end
RubyVM::InstructionSequence.of(method(:hello)).base_label
# => "hello"
@see RubyVM::InstructionS...