るりまサーチ

最速Rubyリファレンスマニュアル検索!
1542件ヒット [401-500件を表示] (0.153秒)

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. kernel p

キーワード

検索結果

<< < ... 3 4 5 6 7 ... > >>

StringScanner#pos=(n) (6155.0)

スキャンポインタのインデックスを n にセットします。

...スキャンポインタのインデックスを n にセットします。

@param n 整数で、バイト単位で指定します。
負数を指定すると文字列の末尾からのオフセットとして扱います。
@raise RangeError マッチ対象の文字列の長さを超え...
...s = StringScanner.new('test string')
p
s.scan(/\w+/) # => "test"
p
s.pos = 1 # => 1
p
s.scan(/\w+/) # => "est"
p
s.pos = 7 # => 7
p
s.scan(/\w+/) # => "ring"

begin
s.pos = 20
rescue RangeError => err
p
uts err #=> index out of range
end
p
s.pos = -4 # => -4
p
s.scan(/\w+/) # => "rin...

Method#inspect -> String (6149.0)

self を読みやすい文字列として返します。

...の文字列を返します。

#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...oo
def foo
"foo"
end
end
class Bar
include Foo
def bar(a, b)
end
end

p
Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p
Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}

klass1 と klass2 が同じ場合は以下の形式になります。...
...end
end
p
obj.method(:foo) # => #<Method: "".foo() foo.rb:4>

# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end
end
p
Foo.method(:foo) # => #<Method: Foo.foo() foo.rb:11>

# スーパークラスのクラスメソッド
class Bar < Foo
end
p
Bar.metho...

Rake::FileList#pathmap(spec = nil) -> Rake::FileList (6149.0)

各要素に String#pathmap を適用した新しい Rake::FileList を返します。

...ing#pathmap を適用した新しい Rake::FileList を返します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
file_list.pathmap("%n") # => ["test1", "test2", "test3"]...
...end
//}

@see String#pathmap...

ARGF.class#each_codepoint -> Enumerator (6137.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

...or を返します。

例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_codepoint # => #<Enumerator: ARGF:each_codepoint>
ARGF.each_codepoint{|e|print e, ","} # => 108,105,110,101,49,10,108,105,1...

ARGF.class#each_codepoint { |c| ... } -> self (6137.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

...or を返します。

例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_codepoint # => #<Enumerator: ARGF:each_codepoint>
ARGF.each_codepoint{|e|print e, ","} # => 108,105,110,101,49,10,108,105,1...

絞り込み条件を変える

Rake::Application#top_level (6137.0)

Rake アプリケーションに与えられたトップレベルのタスク (コマンドラインで指定されたタスク) を実行します。

...たトップレベルのタスク
(コマンドラインで指定されたタスク) を実行します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test1
task :test1
task :test2 do
p
uts "test2"
end

# rake test2 で実行
Rake.application.top_level

# => "test2"
//}...

StringScanner#skip(regexp) -> Integer | nil (6137.0)

スキャンポインタの地点だけで regexp と文字列のマッチを試します。 マッチしたらスキャンポインタを進めマッチした部分文字列の 長さを返します。マッチしなかったら nil を返します。

...ンポインタの地点だけで regexp と文字列のマッチを試します。
マッチしたらスキャンポインタを進めマッチした部分文字列の
長さを返します。マッチしなかったら nil を返します。

@param regexp マッチに使用する正規表現を...
...指定します。

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
p
s.skip(/\w+/) #=> 4
p
s.skip(/\w+/) #=> nil
p
s.skip(/\s+/) #=> 1
p
s.skip(/\w+/) #=> 6
p
s.skip(/./) #=> nil
//}...

OptionParser#parse!(argv = self.default_argv) -> [String] (6131.0)

与えられた argv をパースします。

...ptionParser#permute! と同様に argv を破壊的にパースします。
環境変数に POSIXLY_CORRECT が設定されている場合は、
OptionParser#order! と同様に振舞います。

@param argv パースしたい引数を文字列の配列で指定します。


@raise OptionParser::P...
...実際は OptionParser::ParseError のサブク
ラスになります。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end

ARGV...
...# => ["-i", "-u", "-h", "test"]
opts.parse(ARGV) # => ["test"]
ARGV # => ["-i", "-u", "-h", "test"]
opts.parse!(ARGV) # => ["test"]
ARGV # => ["test"]
//}...

OptionParser#parse!(argv = self.default_argv, into: nil) -> [String] (6131.0)

与えられた argv をパースします。

...す。

OptionParser#permute! と同様に argv を破壊的にパースします。
環境変数に POSIXLY_CORRECT が設定されている場合は、
OptionParser#order! と同様に振舞います。

@param argv パースしたい引数を文字列の配列で指定します。

@param into...
...ションを格納するハッシュを指定します。
指定したハッシュにはオプションの名前をキーとして、OptionParser#onに渡されたブロックの値が格納されます。
キーの名前はロングオプションが定義されていれば...
...se OptionParser::ParseError パースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスになります。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts....

StringScanner#inspect -> String (6131.0)

StringScannerオブジェクトを表す文字列を返します。

...r.new('test string')
s.inspect # => "#<StringScanner 0/11 @ \"test ...\">"
s.scan(/\w+/) # => "test"
s.inspect # => "#<StringScanner 4/11 \"test\" @ \" stri...\">"
s.scan(/\s+/) # => " "
s.inspect...
...# => "#<StringScanner 5/11 \"test \" @ \"strin...\">"
s.scan(/\w+/) # => "string"
s.inspect # => "#<StringScanner fin>"
//}...

絞り込み条件を変える

Rake::TaskArguments#new_scope(names) -> Rake::TaskArguments (6125.0)

与えられたパラメータ名のリストを使用して新しい Rake::TaskArguments を作成します。

...

@param names パラメータ名のリストを指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
arguments = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
new_arguments = arguments.new_scope(["na...
...me3", "name4"])
p
new_arguments # => #<Rake::TaskArguments >
p
new_arguments.names # => ["name3", "name4"]
end
//}...
<< < ... 3 4 5 6 7 ... > >>