検索結果
-
CSV
:: Row # deconstruct -> [object] (18113.0) -
パターンマッチに使用する行の値の配列を返します。
...[1, 2, 3])
case row
in [2.., 2.., 2..]
puts "all 2 or more"
in [...2, 2.., 2..]
puts "first column is less than 2, and rest columns are 2 or more"
end
#=> "first column is less than 2, and rest columns are 2 or more" が出力される
//}
@see d:spec/pattern_matching#matching_non_primitive_ob... -
CSV
:: Row # deconstruct _ keys(keys) -> Hash (6113.0) -
パターンマッチに使用するヘッダの名前と値の Hash を返します。
...er3: 2.. }
puts "all 2 or more"
in { header1: ...2, header2: 2.., header3: 2.. }
puts "first column is less than 2, and rest columns are 2 or more"
end
#=> "first column is less than 2, and rest columns are 2 or more" が出力される
//}
@see d:spec/pattern_matching#matching_non_primitive_ob...