48件ヒット
[1-48件を表示]
(0.142秒)
別のキーワード
クラス
- BasicObject (24)
-
CSV
:: Table (24)
キーワード
- != (12)
-
by
_ col _ or _ row! (12) -
by
_ row! (12)
検索結果
先頭4件
-
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 !
true
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"])
table = CSV::Table.new([row1, row2]).by_col!......table # => #<CSV::Table mode:col row_count:3>
table.by_col_or_row!
table # => #<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"])
table = CSV::Table.new([row1, row2])
table......# => #<CSV::Table mode:col_or_row row_count:3>
table.by_row!
table # => #<CSV::Table mode:row row_count:3>
table[0] # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
//}...