67件ヒット
[1-67件を表示]
(0.107秒)
別のキーワード
クラス
- BasicObject (24)
-
CSV
:: Table (36) - Proc (7)
キーワード
- != (12)
- << (7)
-
by
_ col _ or _ row (12) -
by
_ col _ or _ row! (12) -
by
_ row! (12)
検索結果
先頭5件
-
BasicObject
# ! -> bool (18150.0) -
オブジェクトを真偽値として評価し、その論理否定を返します。
...def initialize
@count = 0
end
attr_reader :count
def !
@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... -
CSV
:: Table # by _ col _ or _ row! -> self (6126.0) -
自身をミックスモードに変更します。
...er1", "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>
//}... -
BasicObject
# !=(other) -> bool (6125.0) -
オブジェクトが other と等しくないことを判定します。
...返します。
このため、サブクラスで BasicObject#== を再定義しても != とは自動的に整合性が
とれるようになっています。
ただし、 BasicObject#!= 自身や 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 recorder.count #=> 2
//}... -
CSV
:: Table # by _ row! -> self (6120.0) -
自身をロウモードに変更します。
...], ["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" "... -
CSV
:: Table # by _ col _ or _ row -> CSV :: Table (25.0) -
ミックスモードになっている新しい CSV::Table オブジェクトを返します。
...der2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2]).by_col!
table # => #<CSV::Table mode:col row_count:3>
col_or_row_table = table.by_col_or_row
col_or_row_table # => #<CSV::Table mode:col_or_row row_count:3>
table # => #<CSV::Table mode:col row_count:3>
//}... -
Proc
# <<(callable) -> Proc (25.0) -
self と引数を合成した Proc を返します。
...anner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = proc { |data| puts "word count: #{data.size}" } << WordScanner << File.method(:read)
pipeline.call('testfile') # => word count: 4
//}
@see Method#<<, Method#>>...