모듈: Mongoid::Persistable::Minable
개요
Defines behavior for setting a field (or fields) to the smaller of either it's current value, or a given value.
인스턴스 메서드 요약 접기
-
#set_min(fields) ⇒ 문서 (동의어: #camp_upper_bound)
Set the given field or fields to the smaller of either it's current value, or a given value.
인스턴스 메서드 세부 정보
#set_min(fields) ⇒ 문서 라고도 함: camp_upper_bound
Set the given field or fields to the smaller of either it's current value, or a given value.
20 21 22 23 24 25 26 27 28 29 30 31 |
# 파일 'lib/mongoid/persistable/minable.rb', 줄 20 def set_min(필드) prepare_atomic_operation do |ops| process_atomic_operations(필드) do |필드, value| current_value = 속성[필드] 만약 value < current_value process_attribute 필드, value ops[atomic_attribute_name(필드)] = value end end { '$min' => ops } 하지 않는 한 ops.비어 있나요? end end |