Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/mysql2wrapper/core_ext.rb
Instance Method Summary collapse
Instance Method Details
#select_one_must(&proc) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/mysql2wrapper/core_ext.rb', line 3 def select_one_must(&proc) result = self.select(&proc) raise StandardError, 'no data selected' if result.size == 0 raise StandardError, "multiple data selected(#{result.size} datas)" if result.size > 1 result.first end |