検索結果
-
Enumerator
# feed(obj) -> nil (18113.0) -
Enumerator 内部の yield が返す値を設定します。
...Object.new
def o.each
x = yield # (2) blocks
p x # (5) => "foo"
x = yield # (6) blocks
p x # (8) => nil
x = yield # (9) blocks
p x # not reached w/o another e.next
end
e = o.to_enum
e.next # (1)
e.feed "foo"... -
rss (468.0)
-
RSS を扱うためのライブラリです。
...RSS::RDF オブジェクト
* RSS 0.9x/2.0をパースした場合は RSS::Rss オブジェクト
* Atom をパースした場合は RSS::Atom::Feed オブジェクト
をそれぞれ返します。パースした
String が well formed な XML で無い場合は,
例外 RSS::NotWellFormedError......(rss_source, true, false)
=== パースされたフィード
フィードをパースすると RSS::RDF, RSS::RDF::Channel,
RSS::Rss, RSS::Atom::Feed 等のオブジェクトになります。
各オブジェクトで子要素オブジェクトにアクセスするために,要素名と
同じ......設定するには以下のよう
にします。RSS::RDF::Channel.newの第一引数にはrdf:about属性の
値を指定することもできます。
rss = RSS::Parser.parse(rss_source)
rss.channel = RSS::RDF::Channel.new(rdf_about_value)
属性値を設定する場合も同様です。... -
正規表現 (48.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...列中のどの場所であるかを知ることができます。
//emlist[][ruby]{
/pat/
%r{pat}
//}
などの正規表現リテラルや Regexp.new などで正規表現
オブジェクトを得ることができます。
===[a:metachar] メタ文字列とリテラル、メタ文字とエス......vertical tab (0x0B)
\n 改行 newline (0x0A)
\r 復帰 return (0x0D)
\b バックスペース back space (0x08)
\f 改ページ form feed (0x0C)
\a ベル......=> nil
//}
オプションは Regexp.new の引数に指定することもできます。
//emlist[][ruby]{
Regexp.new("abc", Regexp::IGNORECASE) # => /abc/i
Regexp.new("abc", Regexp::MULTILINE) # => /abc/m
Regexp.new("abc # Comment", Regexp::EXTENDED)... -
制御構造 (18.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...結果を返します。
条件が成立しなければ nil を返します。
====[a:unless] unless
//emlist[例][ruby]{
unless baby?
feed_meat
else
feed_milk
end
//}
文法:
unless 式 [then]
式 ...
[else
式 ... ]
end
unless は if......# 例外 RuntimeError を発生させる
# 以下の二つは SyntaxError を発生させる
raise SyntaxError, "invalid syntax"
raise SyntaxError.new("invalid syntax")
raise # 最後の例外の再発生
//}
文法:
raise
raise messageまたはexception...