84件ヒット
[1-84件を表示]
(0.020秒)
キーワード
-
cgi
/ session (12) -
fiddle
/ import (12) - pp (12)
- rdoc (12)
- rss (12)
- tsort (12)
-
yaml
/ store (12)
検索結果
-
rss (43.0)
-
RSS を扱うためのライブラリです。
...(["My site", ...]など)
rss.channel.dc_titles.first.value == rss.channel.dc_title
# => true
# 厳密にはこう
first_title = rss.channel.dc_titles.first
first_title = first_title.value if first_title
first_title == rss.channel.dc_title... -
fiddle
/ import (19.0) -
fiddle ライブラリのための高レベルインターフェースを提供するライブラリです。
...する関数
void first_char(char **s, char *buf, int len)
があったとします。これを呼び出すにも以下のように Array#pack を使用します。
require 'fiddle/import'
module M
extend Fiddle::Importer
dlload './libstrfirst.so'
extern 'void first_char(char **, char......*, int)'
end
buf = '111'
M.first_char(['Abc', 'Def', 'Ghi'].pack('p*'), buf, 3)
p buf #=> 'ADG'
==== Ruby のオブジェクトをコールバックに渡したい
任意のクラスの Ruby オブジェクトをコールバックへ渡したい場合は Fiddle.#dlwrap を使って
ポイン... -
pp (19.0)
-
オブジェクトなどを見やすく出力するためのライブラリです。
...す。
//emlist[][ruby]{
require 'pp'
class Hash
def pretty_print(q)
q.group(2, "<hash>") do
q.breakable
first = true
self.each{|k, v|
unless first
q.text(',')
q.breakable
end
q.pp k
q.text ' => '
q.group(1) do......e ''
if v.is_a?(String) and v.size > 10
q.pp(v[0..9] + '...')
else
q.pp v
end
end
first = false
}
end
q.breakable
q.text "</hash>"
end
def pretty_print_cycle(q)
q.text(empty? ? '{}' : '{...}')
end
end......イズの例です。
//emlist[][ruby]{
class Hash
def pretty_print(q)
q.group(2, "<hash>") do
q.breakable
first = true
self.each{|k, v|
unless first
q.text(',')
q.breakable
end
q.pp k
q.text ' => '
q.group(1) do... -
yaml
/ store (19.0) -
RubyのオブジェクトをYAML形式の外部ファイルに格納するためのクラスです。
...ブジェクトをYAML形式の外部ファイルに格納するためのクラスです。
例:
require 'yaml/store'
Person = Struct.new :first_name, :last_name
people = [Person.new("Bob", "Smith"), Person.new("Mary", "Johnson")]
store = YAML::Store.new "test.store"
store.transactio......] = { "hello" => "world" }
end
上記のコードを実行すると "test.store" は以下のようになります。
---
people:
- !ruby/struct:Person
first_name: Bob
last_name: Smith
- !ruby/struct:Person
first_name: Mary
last_name: Johnson
greeting:
hello: world... -
cgi
/ session (13.0) -
CGI のセッション管理を行うライブラリ。
...たくないよ
@session = CGI::Session.new(@cgi) # セッションはこうして生成する。
@cmd = "#{@cgi['cmd'].first}" # ruby 1.8 でも動くように(warning は出ます)
@cmd = 'start' if @cmd.empty?
@header = { "type" => "text/htm......">
</p>
</form>
</body></html>
END
}
end
def cmd_hello
name = Kconv.toeuc(@cgi['name'].first)
@session['name'] = name # セッションに記憶
@cgi.out(@header) { # セッシ... -
tsort (13.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...gth != 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 = inputs.map {|f| File.mtime f}.max
begin
outputs_ti......分に関するアルゴリズムを使っているからです。
とはいえ strongly_connected_components という正確な名前は長過ぎます。
=== References
R. E. Tarjan,
Depth First Search and Linear Graph Algorithms,
SIAM Journal on Computing, Vol. 1, No. 2, pp. 146-160, June 1972.... -
rdoc (7.0)
-
RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。
...です。
<tt>--output</tt> <i>name [, name]</i>::
specify the name of one or more output files. If multiple
files are present, the first is used as the index.
<tt>--quiet:</tt>:: do not output the names, sizes, byte counts,
index areas, or bit ratios of units...