るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

BasicObject#! -> bool (21204.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"
//}...

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

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

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

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

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

@
param ot...
...
@
see BasicObject#==, 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 r...

CSV::Table#by_col_or_row! -> self (9144.0)

自身をミックスモードに変更します。

...

@
return 必ず自身を返すので安全にメソッドチェーンできます。

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

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
t
able = CSV::Table.new([row1, row2]).by_col!...
...table # => #<CSV::Table mode:col row_count:3>
t
able.by_col_or_row!
t
able # => #<CSV::Table mode:col_or_row row_count:3>
//}...

CSV::Table#by_row! -> self (9138.0)

自身をロウモードに変更します。

...

@
return 必ず自身を返すので安全にメソッドチェーンできます。

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

row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
t
able = CSV::Table.new([row1, row2])
t
able...
...# => #<CSV::Table mode:col_or_row row_count:3>
t
able.by_row!
t
able # => #<CSV::Table mode:row row_count:3>
t
able[0] # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
t
able[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
//}...