ライブラリ
- ビルトイン (32)
-
json
/ add / exception (12) - shell (12)
-
shell
/ command-processor (12) -
shell
/ filter (12) - strscan (84)
クラス
- Exception (44)
- Shell (12)
-
Shell
:: CommandProcessor (12) -
Shell
:: Filter (12) - StringScanner (84)
キーワード
- [] (18)
-
backtrace
_ locations (12) -
beginning
_ of _ line? (12) - bol? (12)
- peek (12)
- peep (12)
- pointer= (12)
- pos= (12)
-
set
_ backtrace (12) -
to
_ json (12) - unscan (12)
検索結果
先頭5件
- Shell
# test(command , file1 , file2 = nil) -> bool | Time | Integer | nil - Shell
:: CommandProcessor # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil - Shell
:: Filter # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil - StringScanner
# beginning _ of _ line? -> bool - StringScanner
# bol? -> bool
-
Shell
# test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (15136.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@para......ell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest... -
Shell
:: CommandProcessor # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (15136.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@para......ell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest... -
Shell
:: Filter # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (15136.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@para......ell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest... -
StringScanner
# beginning _ of _ line? -> bool (6107.0) -
スキャンポインタが行頭を指しているなら true を、 行頭以外を指しているなら false を返します。
...いることです。
文字列末尾は必ずしも行頭ではありません。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new("test\nstring")
s.bol? # => true
s.scan(/\w+/)
s.bol? # => false
s.scan(/\n/)
s.bol? # => true
s.scan(/\w+/)
s.bol? # => false... -
StringScanner
# bol? -> bool (3007.0) -
スキャンポインタが行頭を指しているなら true を、 行頭以外を指しているなら false を返します。
...いることです。
文字列末尾は必ずしも行頭ではありません。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new("test\nstring")
s.bol? # => true
s.scan(/\w+/)
s.bol? # => false
s.scan(/\n/)
s.bol? # => true
s.scan(/\w+/)
s.bol? # => false... -
StringScanner
# peek(bytes) -> String (67.0) -
スキャンポインタから長さ bytes バイト分だけ文字列を返します。
...タから長さ bytes バイト分だけ文字列を返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.peek(4) # => "test"
//}
また、このメソッドを実行してもスキャンポインタは移動しません。
StringScanner#peep は将来の......'strscan'
s = StringScanner.new('test string')
p s.peek(4) # => "test"
p s.peek(20) # => "test string"
p s.peek(0) # => ""
begin
s.peek(-1)
rescue ArgumentError => err
puts err # negative string size (or size too big)
end
p s.scan(/\w+/) # => "test"
p s.scan(/\s+/) # => " "
p s.scan......ing"
p s.peek(4) # => ""
# このメソッドを実行してもスキャンポインタは移動しません。
s = StringScanner.new('test string')
p s.peek(4) # => "test"
p s.peek(4) # => "test"
p s.scan(/\w+/) # => "test"
p s.peek(4) # => " str"
p s.peek(4) # => " str"
//}... -
StringScanner
# peep(bytes) -> String (67.0) -
スキャンポインタから長さ bytes バイト分だけ文字列を返します。
...タから長さ bytes バイト分だけ文字列を返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.peek(4) # => "test"
//}
また、このメソッドを実行してもスキャンポインタは移動しません。
StringScanner#peep は将来の......'strscan'
s = StringScanner.new('test string')
p s.peek(4) # => "test"
p s.peek(20) # => "test string"
p s.peek(0) # => ""
begin
s.peek(-1)
rescue ArgumentError => err
puts err # negative string size (or size too big)
end
p s.scan(/\w+/) # => "test"
p s.scan(/\s+/) # => " "
p s.scan......ing"
p s.peek(4) # => ""
# このメソッドを実行してもスキャンポインタは移動しません。
s = StringScanner.new('test string')
p s.peek(4) # => "test"
p s.peek(4) # => "test"
p s.scan(/\w+/) # => "test"
p s.peek(4) # => " str"
p s.peek(4) # => " str"
//}... -
StringScanner
# unscan -> self (55.0) -
スキャンポインタを前回のマッチの前の位置に戻します。
...回のマッチの前の位置に戻します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.scan(/\w+/) # => "test"
s.unscan
s.scan(/\w+/) # => "test"
//}
@return selfを返します。
このメソッドでポインタを戻せるのは 1 回分だけです......StringScanner.new('test string')
begin
# マッチを一度も行っていないので、例外が発生する。
s.unscan
rescue StringScanner::Error => err
puts err
# 出力例
#=> unscan failed: previous match had failed
end
p s.scan(/\w+/) # => "test"
s.unscan
begin
# 二回以上......escue StringScanner::Error => err
puts err
# 出力例
#=> unscan failed: previous match had failed
end
p s.scan(/\w+/) # => "test"
p s.scan(/\w+/) # => nil
begin
# 前回のマッチが失敗しているので、例外が発生する。
s.unscan
rescue => err
puts err
# 出力例
#=... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (37.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception......{ check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Shell
# [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (36.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@para......ell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest... -
Shell
:: CommandProcessor # [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (36.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@para......ell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest...