るりまサーチ

最速Rubyリファレンスマニュアル検索!
181件ヒット [1-100件を表示] (0.141秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

BasicObject#! -> bool (21174.0)

オブジェクトを真偽値として評価し、その論理否定を返します。

... Ruby の制御式において nil や false 以外が偽として
扱われることはありません。

@return オブジェクトが偽であれば真、さもなくば偽

//emlist[例][ruby]{
class NegationRecorder < BasicObject
def initialize
@count = 0
end

attr_reader :count...
...ef !
@count += 1
super
end

end


recorder = NegationRecorder.new
!
recorder
!
!!!!!!recorder
puts 'hoge' if !recorder

puts recorder.count #=> 3
//}

//emlist[例][ruby]{
class AnotherFalse < BasicObject
def !
t
rue
end

end

another_false = AnotherFalse.new

# another_falseは*真*
puts...
..."another false is a truth" if another_false
#=> "another false is a truth"
//}...

Rake::FileList#existing! -> self (12220.0)

自身に含まれるファイルのうちファイルシステムに存在するファイルのみを 含むように自身を変更して返します。

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

IO.write("test1.rb", "test")
IO.write("test2.rb", "test")

t
ask default: :test_rake_app
t
ask :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
file_list.existing! # => ["test1.rb", "test2.rb"]
file_list...
...# => ["test1.rb", "test2.rb"]
end

//}...

String#delete_suffix!(suffix) -> self | nil (12213.0)

self の末尾から破壊的に suffix を削除します。

...ます。

@return 削除した場合は self、変化しなかった場合は nil

//emlist[][ruby]{
"hello".delete_suffix!("llo") # => "he"
"hello".delete_suffix!("hel") # => nil
//}

@see String#chomp!
@see String#chop!
@see String#delete_prefix!
@see String#delete_suffix
@see String#end_with?...

BasicObject#!=(other) -> bool (9225.0)

オブジェクトが other と等しくないことを判定します。

...オブジェクトが other と等しくないことを判定します。

デフォルトでは self == other を評価した後に結果を論理否定して返します。
このため、サブクラスで BasicObject#== を再定義しても != とは自動的に整合性が
とれるように...
...ct#!= 自身や BasicObject#! を再定義した際には、ユーザーの責任で
整合性を保たなくてはなりません。

このメソッドは主に論理式の評価に伴って副作用を引き起こすことを目的に
再定義するものと想定されています。

@param ot...
...ject#==, BasicObject#!

//emlist[例][ruby]{
class NonequalityRecorder < BasicObject
def initialize
@count = 0
end

attr_reader :count

def !=(other)
@count += 1
super
end

end

recorder = NonequalityRecorder.new

recorder != 1
puts 'hoge' if recorder != "str"

p recorder.count #=...

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

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

...

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

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


@raise OptionPar...
...実際は 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] (9213.0)

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

...

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

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

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

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

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

Rake::FileList#gsub!(pattern, replace) -> self (9213.0)

自身に含まれるファイルリストのそれぞれのエントリに対して String#gsub を実行します。 自身を破壊的に変更します。

...String#gsub を実行します。
自身を破壊的に変更します。

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

IO.write("test1.rb", "test")
IO.write("test2.rb", "test")

t
ask default: :test_rake_app
t
ask :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3....
...rb")
file_list.gsub!(/\.rb/, ".erb") # => ["test1.erb", "test2.erb", "test3.erb"]
file_list # => ["test1.erb", "test2.erb", "test3.erb"]
end

//}...

Rake::FileList#sub!(pattern, replace) -> self (9213.0)

自身に含まれるファイルリストのそれぞれのエントリに対して String#sub を実行します。 自身を破壊的に変更します。

...対して String#sub を実行します。
自身を破壊的に変更します。

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

t
ask default: :test_rake_app
t
ask :test_rake_app do
file_list = FileList['a.c', 'b.c']
file_list.sub!(/\.c$/, '.o') # => ['a.o', 'b.o']
file_list...
...# => ['a.o', 'b.o']
end

//}...

Module#instance_method(name) -> UnboundMethod (6149.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...boundMethod を返します。

@param name メソッド名を Symbol または String で指定します。

@raise NameError self に存在しないメソッドを指定した場合に発生します。

@see Module#public_instance_method, Object#method

//emlist[例][ruby]{
class Interpreter
de...
...int "there, "; end
def do_d() print "Hello "; end
def do_e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(str...
...ing)
string.each_char {|b| Dispatcher[b].bind(self).call }
end

end


interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...

String#unpack(template) -> Array (3981.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...ンプレート文字列 template にしたがってアンパックし、
それらの要素を含む配列を返します。

@param template pack テンプレート文字列
@return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack
のテンプレ...
...の説明の中で、
short や long はシステムによらずそれぞれ 2, 4バイトサ
イズの数値(32ビットマシンで一般的なshort, longのサイズ)を意味していま
す。s, S, l, L に対しては直後に _ または ! を "s_" あるいは "s!" のように
続けるこ...
...テム依存の short, long のサイズにすることもできます。

i, I (int)のサイズは常にシステム依存であり、n, N, v, V
のサイズは常にシステム依存ではない(!をつけられない)ことに注意してください。

つまり、IO#ioctl などで C の構...
...レート文字列 template にしたがってアンパックし、
それらの要素を含む配列を返します。

@param template pack テンプレート文字列
@return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack、String#unpack1
...

絞り込み条件を変える

<< 1 2 > >>