58件ヒット
[1-58件を表示]
(0.035秒)
検索結果
先頭5件
-
rss (169.0)
-
RSS を扱うためのライブラリです。
...数に false を指定して
ください。こうすると、パース中に知らない要素に遭遇した時に
RSS::UnknownTagError 例外が発生します。RSS::UnknownTagError
クラスは RSS::InvalidError クラスのサブクラスです。
以下のようにすると,より厳密に......設定するには以下のよう
にします。RSS::RDF::Channel.newの第一引数にはrdf:about属性の
値を指定することもできます。
rss = RSS::Parser.parse(rss_source)
rss.channel = RSS::RDF::Channel.new(rdf_about_value)
属性値を設定する場合も同様です。......配列に対して
Array#<<やArray#[]=などを用いて要素を設定します.
rss = RSS::Parser.parse(rss_source)
item = RSS::RDF::Item.new(rdf_about_value)
rss.items << item
rss.items.last == item # => true
注意: item=/set_itemなどはRubyっぽくないので使わないでく... -
cgi (139.0)
-
CGI プログラムの支援ライブラリです。
...) Version 1.1
* https://www.w3.org/CGI/
=== 使用例
==== フォームフィールドの値を得る
//emlist[][ruby]{
require "cgi"
cgi = CGI.new
values = cgi['field_name'] # <== 'field_name' の配列
# 'field_name' が指定されていなかったら、 ""を返す。
fields = cgi.keys......gi = CGI.new
params = cgi.params
//}
また CGI#params は毎回同じ Hash オブジェクトを返すので
以下のような使いかたもできます。
//emlist[][ruby]{
cgi.params['new_field_name'] = ["value"] # 新しいパラメータを加える
cgi.params['field_name'] = ["new_value"]......e を使うのが最も簡単です。
//emlist[][ruby]{
# 保存
require 'pstore'
db = PStore.new("query.db")
db.transaction do
db["params"] = cgi.params
end
# 復帰
require 'pstore'
db = PStore.new("query.db")
db.transaction do
cgi.params = db["params"]
end
//}
ただし、PStore は Ruby... -
webrick
/ cgi (67.0) -
一般の CGI 環境で webrick ライブラリのサーブレットと同じように CGI スクリプトを書くための ライブラリです。サーバが WEBrick でなくても使うことが出来ます。
...ss MyCGI < WEBrick::CGI
def do_GET(req, res)
res["content-type"] = "text/plain"
ret = "hoge\n"
res.body = ret
end
end
MyCGI.new.start()
==== do_XXX メソッド
do_XXX メソッドの XXX には GET, HEAD, POST, PUT, DELETE, OPTIONS が使用できます。
WEBrick::CGI......GET(req, res)
req.query #=> Hash を返します。
req.query['q']
req.query['num']
end
end
MyCGI.new.start()
同じ名前のフィールドが複数ある場合、list メソッドや each_data メソッドを使います。
require "webrick/cgi......GI
def do_GET(req, res)
req.query['q'].list #=> フォームの値を保持した文字列の配列を返します。
end
end
MyCGI.new.start()
query メソッドが返す Hash オブジェクトのキーと値のうち値は WEBrick::HTTPUtils::FormData クラスの
インスタ... -
xmlrpc (49.0)
-
XML-RPC を扱うためのライブラリです。
...ions that span
computer languages. Its distinctive feature is its simplicity compared to
other approaches like SOAP and CORBA.
The Ruby standard library package 'xmlrpc' enables you to create a server that
implements remote procedures and a client that calls them. Very little code
is required to......e
Try the following code. It calls a standard demonstration remote procedure.
require 'xmlrpc/client'
require 'pp'
server = XMLRPC::Client.new2("http://xmlrpc-c.sourceforge.net/api/sample.php")
result = server.call("sample.sumAndDifference", 5, 3)
pp result
=== Documentation
See http......component architecture Client interface
=== Choosing a different XML Parser or XML Writer
The examples above all use the default parser (which is now since 1.8
REXMLStreamParser) and a default XML writer. If you want to use a different
XML parser, then you have to call the <i>set_parser</i> meth... -
drb (25.0)
-
分散オブジェクトプログラミングのためのライブラリです。
...意の Ruby のコードを実行できて
しまいます。例えば以下のようなことができます。
# !! 危険 !!
ro = DRbObject.new_with_uri("druby://your.server.com:8989")
class << ro
# リモートオブジェクトの instance_eval を呼ぶため
# ローカルオ......y://localhost:8787"
class TimeServer
def get_current_time
return Time.now
end
end
# サーバ側でリクエストを受け付けるオブジェクト
FRONT_OBJECT=TimeServer.new
# サーバを起動する
DRb.start_service(SERVER_URI, FRONT_OBJECT, :safe_lev......ブジェクト以外の
# リモートオブジェクトのメソッドを呼び出す時には必要
DRb.start_service
# リモートオブジェクトの取得
timeserver = DRbObject.new_with_uri(SERVER_URI)
# リモートメソッドの呼び出し
puts timeserver.get_current_time... -
tsort (19.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...each_strongly_connected_component_from(target) {|ns|
if ns.length != 1
fs = ns.delete_if {|n| Array === n}
raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
end
n = ns.first
if Array === n
outputs, inputs, block = n
inputs_time =......ime != nil && inputs_time.to_i == Time.now.to_i
block.call
end
end
}
end
def tsort_each_child(node, &block)
@dep[node].each(&block)
end
include TSort
end
def command(arg)
print arg, "\n"
system arg
end
m = Make.new
m.rule(%w[t1]) { command 'date > t1' }...