66件ヒット
[1-66件を表示]
(0.028秒)
検索結果
先頭5件
-
rss (115.0)
-
RSS を扱うためのライブラリです。
...MLStyleSheet.new(...)
RSS::XMLStyleSheet.newには以下のようなHashまたは
連想配列を渡します.作成されるRSS::XMLStyleSheetオブジェ
クトは与えられた引数によって初期化されます.
Hash:
{
:href => "...",
:type => "...",
:title => "...",.......com/"
maker.items.new_item do |item|
item.link = "http://example.com/article.html"
item.title = "Sample Article"
item.date = Time.parse("2004/11/1 10:10")
end
end
サンプル中の
item.date = ...
は
item.dc_date = ...
でも構いません.#dc_date=は#dat......ml"
item.title = "Sample Article"
item.date = Time.parse("2004/11/1 10:10")
end
maker.items.new_item do |item|
item.link = "http://example.com/article2.html"
item.title = "Sample Article2"
item.date = Time.parse("2004/11/2 10:10")
end
end
===== エント... -
yaml (79.0)
-
構造化されたデータを表現するフォーマットであるYAML (YAML Ain't Markup Language) を扱うためのライブラリです。
...quire 'yaml'
require 'stringio'
strio_r = StringIO.new(<<~YAML_EOT)
---
time: 2008-02-25 17:03:12 +09:00
target: YAML
version: 4
log: |
例を加えた。
アブストラクトを修正した。
---
time: 2008-02-24 17:00:35 +09:00
target: YAML
version: 3
log: |
ア......rsion"] }.each do |obj|
puts "version %d\ntime %s\ntarget:%s\n%s\n" % obj.values_at("version", "time", "target", "log")
end
# =>
# version 3
# time 2008-02-24 17:00:35 +0900
# target:YAML
# アブストラクトを書いた。
#
# version 4
# time 2008-02-25 17:03:12 +0900
# target:YAML
#......けに以下のローカルタグを扱えます。
* !ruby/array: Array オブジェクト
* !ruby/class: Class オブジェクト
* !ruby/hash: Hash オブジェクト
* !ruby/module: Module オブジェクト
* !ruby/regexp: Regexp オブジェクト
* !ruby/range: Range オブジェク... -
tsort (67.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...トポロジカルソートと強連結成分に関するモジュールを提供します。
=== Example
//emlist[][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
{1=>[2, 3], 2=>[3],......inputs_time = inputs.map {|f| File.mtime f}.max
begin
outputs_time = outputs.map {|f| File.mtime f}.min
rescue Errno::ENOENT
outputs_time = nil
end
if outputs_time == nil ||
inputs_time != nil && outputs_time <= inputs_time......sleep 1 if inputs_time != 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]) { c... -
cgi (31.0)
-
CGI プログラムの支援ライブラリです。
...るには CGI#params を使います。
//emlist[例][ruby]{
require "cgi"
cgi = CGI.new
params = cgi.params
//}
また CGI#params は毎回同じ Hash オブジェクトを返すので
以下のような使いかたもできます。
//emlist[][ruby]{
cgi.params['new_field_name'] = ["value"] #......I.new
for name, cookie in cgi.cookies
cookie.expires = Time.now + 30
end
cgi.out("cookie" => cgi.cookies){"string"}
cgi.cookies # { "name1" => cookie1, "name2" => cookie2, ... }
require "cgi"
cgi = CGI.new
cgi.cookies['name'].expires = Time.now + 30
cgi.out("cookie" => cgi.cookies['name']){"stri......ソッドの引数としては、基本的に Hash オブジェクトが与えられる(あるいは何も与えられない)べきです。
ただし以下に列挙されたメソッドでは、各メソッドの引数の形式に従って、 Hash オブジェクト以外のものを渡すこ... -
webrick
/ cgi (31.0) -
一般の CGI 環境で webrick ライブラリのサーブレットと同じように CGI スクリプトを書くための ライブラリです。サーバが WEBrick でなくても使うことが出来ます。
...ルドの値は WEBrick::HTTPRequest#query メソッドが返す Hash オブジェクトに
収納されています。
require "webrick/cgi"
class MyCGI < WEBrick::CGI
def do_GET(req, res)
req.query #=> Hash を返します。
req.query['q']
req.query['n......['q'].list #=> フォームの値を保持した文字列の配列を返します。
end
end
MyCGI.new.start()
query メソッドが返す Hash オブジェクトのキーと値のうち値は WEBrick::HTTPUtils::FormData クラスの
インスタンスになります。FormData クラス......::CGI
def do_GET(req, res)
c1 = WEBrick::Cookie.new("name1", "val1")
c1.expires = Time.now + 30
res.cookies << c1
c2 = WEBrick::Cookie.new("name2", "val2")
c2.expires = Time.now + 30
res.cookies << c2
end
end
MyCGI.new.start()
==== クライアントか... -
rdoc (13.0)
-
RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。
...に指定した --op を上書きします。デフォルトのディレクトリ
は ri のデフォルトのサーチパスです。
: --show-hash
コメント内の name というところからインスタンスメソッドへのハイパーリ
ンクを生成します。このオプシ......ct the age and calculate the
# date-of-birth.
#--
# FIXME: fails if the birthday falls on
# February 29th
#++
# The DOB is returned as a Time object.
def get_dob(person)
...
====[a:list] リスト
リストは以下のような記号が付いたパラグラフです。
* '*'...