module ActsAsHoldable::Holdable::Core::InstanceMethods
Public Instance Methods
be_held!(holder, opts={})
click to toggle source
# File lib/acts_as_holdable/holdable/core.rb, line 118 def be_held!(holder, opts={}) holder.hold!(self, opts) end
check_availability(opts)
click to toggle source
# File lib/acts_as_holdable/holdable/core.rb, line 112 def check_availability(opts) check_availability!(opts) rescue ActsAsHoldable::AvailabilityError false end
check_availability!(opts)
click to toggle source
# File lib/acts_as_holdable/holdable/core.rb, line 98 def check_availability!(opts) # validates options validate_holding_options!(opts) if holding_opts[:on_hand_type] != :none # Amount > on_hand if opts[:amount] > on_hand raise ActsAsHoldable::AvailabilityError, ActsAsHoldable::T.er('.availability.amount_gt_on_hand', model: self.class.to_s) end end true end
hold!(holder, opts)
click to toggle source
# File lib/acts_as_holdable/holdable/core.rb, line 122 def hold!(holder, opts) holder.hold(self, opts) end
holder?()
click to toggle source
# File lib/acts_as_holdable/holdable/core.rb, line 130 def holder? self.class.holder? end
validate_holding_options!(opts)
click to toggle source
# File lib/acts_as_holdable/holdable/core.rb, line 126 def validate_holding_options!(opts) self.class.validate_holding_options!(opts) end