ライブラリ
- ビルトイン (55)
- continuation (11)
-
irb
/ context (11) - psych (11)
-
rexml
/ document (11) -
rinda
/ rinda (11) - strscan (11)
-
webrick
/ httpauth / htpasswd (11)
キーワード
- Context (11)
- Continuation (11)
- Emitter (11)
- FalseClass (11)
- Htpasswd (11)
- NilClass (11)
- Range (11)
- Stat (11)
- String (11)
- StringScanner (11)
- Template (11)
- XMLDecl (11)
検索結果
-
FalseClass (6065.0)
-
false のクラス。 false は FalseClass クラスの唯一のインスタンスです。 false は nil オブジェクトとともに偽を表し、 その他の全てのオブジェクトは真です。
...false のクラス。
false は FalseClass クラスの唯一のインスタンスです。
false は nil オブジェクトとともに偽を表し、
その他の全てのオブジェクトは真です。... -
NilClass (6065.0)
-
nil のクラス。 nil は NilClass クラスの唯一のインスタンスです。 nil は false オブジェクトとともに偽を表し、 その他の全てのオブジェクトは真です。
...nil のクラス。
nil は NilClass クラスの唯一のインスタンスです。
nil は false オブジェクトとともに偽を表し、
その他の全てのオブジェクトは真です。... -
Range (139.0)
-
範囲オブジェクトのクラス。 範囲オブジェクトは文字どおり何らかの意味での範囲を表します。数の範囲はもちろん、 日付の範囲や、「"a" から "z" まで」といった文字列の範囲を表すこともできます。
...らは、終端に nil を与えることで「終端を持たない範囲オブジェクト」
を作ることができるようになりました。
//emlist[終端を持たない範囲オブジェクト][ruby]{
p Range.new(1, nil) # 1 以上(上限無し)を表す
p(1..nil) # 同.......7.0 では始端に nil を与えることで「始端を持たない範囲オブジェクト」
を作ることもできるようになりました。
//emlist[始端を持たない範囲オブジェクト][ruby]{
p Range.new(nil, 5) # 5 以下(下限無し)を表す
p(nil..5) # 同......ない範囲オブジェクト][ruby]{
# 以下はすべて同じ範囲
p Range.new(nil, nil) # => nil..nil
p(nil..nil) # => nil..nil
p(..nil) # => nil..nil
p(nil..) # => nil..nil
//}
範囲式で両端を略した書き方はできません。
p(..) # => Syn... -
StringScanner (109.0)
-
StringScanner は文字列スキャナクラスです。 簡単に高速なスキャナを記述できます。
...ringScanner.new('This is an example string')
s.eos? #=> false
p s.scan(/\w+/) #=> "This"
p s.scan(/\w+/) #=> nil
p s.scan(/\s+/) #=> " "
p s.scan(/\s+/) #=> nil
p s.scan(/\w+/) #=> "is"
s.eos? #=> false
p s.scan(/\s+/) #=> " "
p s.scan(/\w+/) #=> "an"
p s.scan(/.......scan(/\w+/) #=> "example"
p s.scan(/\s+/) #=> " "
p s.scan(/\w+/) #=> "string"
s.eos? #=> true
p s.scan(/\s+/) #=> nil
p s.scan(/\w+/) #=> nil
//}
StringScanner オブジェクトはスキャンする文字列と「スキャンポインタ」のセットです。
スキャン......ple string s.eos? = false
s.scan(/\w+/)
# This_ is an example string s.eos? = false
s.scan(/\s+/)
# This _is an example string s.eos? = false
s.scan(/\w+/)
# This is_ an example string s.eos? = false
s.scan(/\s+/)
# This is _an example string s.eos? = false
s.scan(/\w+/)
# This i... -
Psych
:: Emitter (103.0) -
Psych::Parser でパースし、生じたイベントから YAML ドキュメントを再構築するようなハンドラです。
...nt([1, 1], [], false)
emitter.start_mapping(nil, nil, false, Psych::Nodes::Mapping::BLOCK)
emitter.scalar("a", nil, nil, true, false, Psych::Nodes::Scalar::PLAIN)
emitter.scalar("12", nil, nil, true, false, Psych::Nodes::Scalar::PLAIN)
emitter.scalar("xyz", nil, nil, true, false, Psych::Node......s::Scalar::PLAIN)
emitter.scalar("23", nil, nil, false, true, Psych::Nodes::Scalar::SINGLE_QUOTED)
emitter.end_mapping
emitter.end_document(false)
emitter.end_stream
puts output.string
# =>
# %YAML 1.1
# ---
# a: 12
# xyz: '23'
# ...... -
Rinda
:: Template (49.0) -
タプルのマッチングのためのクラスです。 ユーザがこのクラスを直接使うことはありません。
...', nil, nil])
template.match(['abc', 2, 5]) # => true
template.match(['hoge', 2, 5]) # => false
template = Rinda::Template.new([String, Integer, nil])
template.match(['abc', 2, 5]) # => true
template.match(['abcd', 2, 5]) # => true
template = Rinda::Template.new([/^abc/, Integer, nil]......)
template.match([/^abc/, Integer, nil]) # => true
template.match(['abc', 2, 5]) # => true
template.match(['def', 2, 5]) # => false
template = Rinda::Template.new({'name' => String, 'age' => Integer})
template.match({'name' => 'seki', 'age' => 0x20}) # => true
template.......match({'name' => :seki, 'age' => 0x20}) # => false... -
Range (37.0)
-
範囲オブジェクトのクラス。 範囲オブジェクトは文字どおり何らかの意味での範囲を表します。数の範囲はもちろん、 日付の範囲や、「"a" から "z" まで」といった文字列の範囲を表すこともできます。
...らは、終端に nil を与えることで「終端を持たない範囲オブジェクト」
を作ることができるようになりました。
//emlist[終端を持たない範囲オブジェクト][ruby]{
p Range.new(1, nil) # 1 以上(上限無し)を表す
p(1..nil) # 同......定][ruby]{
p (1..5).cover?(6) # => false
p (1..5).cover?(5) # => true
p (1...5).cover?(5) # => false
//}
Range#cover? メソッドでの判定には演算子 <=> が使われます。
当然、始端と終端は <=> メソッドで比較可能である(nil 以外を返す)必要が
あり... -
Continuation (31.0)
-
継続を表すクラスです。
...:
以下は、Continuationによる無限ループの例
def LOOP
c = nil
yield callcc {|cnt| c = cnt; true }
c.call(false)
end
LOOP {|v| p v}
=> true
false
false
false
:
:
callcc とは、call-with-current-continuation の略です。... -
IRB
:: Context (25.0) -
irb の設定を扱うためのクラスです。
...IRB::Context が渡されます。
そのため、サブ irb の設定をまとめて実行するのに使用します。
デフォルト値は nil です。
lib:irb#configure_sub_irb も併せて参照してください。
: IRB.conf[:LC_MESSAGES]
ライブラリ内部で使用します......デフォルト値は nil です。
: IRB.conf[:SINGLE_IRB]
irb 中で self を実行して得られるオブジェクトをサブ irb と共有するかど
うかを設定します。true を設定した場合に共有されます。
デフォルト値は false です。
: IRB.conf[:V......ERSION]
IRB.version を実行した時に返すバージョンを String で指定
します。
デフォルト値は nil です。
: IRB.conf[:__MAIN__]
ライブラリ内部で使用します。... -
File
:: Stat (19.0) -
ファイルの情報を格納したオブジェクトのクラス。
...る点が違います。
//emlist[][ruby]{
p File::Stat.new($0).directory? #=> false
p FileTest.directory?($0) #=> false
//}
1.8 以降では、属性メソッドがシステムでサポートされていない場合 nil が返ります。
なお、1.7 以前では 0 が返っていました。... -
REXML
:: XMLDecl (19.0) -
XML 宣言を表すクラス。
...ent.new(<<EOS)
<e />
EOS
xml_decl = doc.xml_decl
xml_decl.version # => "1.0"
xml_decl.encoding # => "UTF-8"
xml_decl.standalone # => nil
xml_decl.writethis # => false
//}
//emlist[XML 宣言が encoding 属性を持たない場合の例][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<......EOS)
<?xml version="1.0" ?>
<e />
EOS
xml_decl = doc.xml_decl
xml_decl.version # => "1.0"
xml_decl.encoding # => "UTF-8"
xml_decl.standalone # => nil
xml_decl.writethis # => true
//}...