Class: Royal::InsufficientPointsError

Inherits:
Error
  • Object
show all
Defined in:
lib/royal/insufficient_points_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, amount, balance, reason, pointable) ⇒ InsufficientPointsError

Returns a new instance of InsufficientPointsError.

Parameters:

  • owner (ActiveRecord::Base)
  • amount (Integer)
  • balance (Integer)
  • reason (String, nil)
  • pointable (ActiveRecord::Base, nil)


21
22
23
24
25
26
27
28
29
# File 'lib/royal/insufficient_points_error.rb', line 21

def initialize(owner, amount, balance, reason, pointable)
  @owner     = owner
  @amount    = amount
  @balance   = balance
  @reason    = reason
  @pointable = pointable

  super("Insufficient points: #{amount} (balance: #{balance})")
end

Instance Attribute Details

#amountInteger (readonly)

Returns:

  • (Integer)


8
9
10
# File 'lib/royal/insufficient_points_error.rb', line 8

def amount
  @amount
end

#balanceInteger (readonly)

Returns:

  • (Integer)


10
11
12
# File 'lib/royal/insufficient_points_error.rb', line 10

def balance
  @balance
end

#ownerActiveRecord::Base (readonly)

Returns:

  • (ActiveRecord::Base)


6
7
8
# File 'lib/royal/insufficient_points_error.rb', line 6

def owner
  @owner
end

#pointableActiveRecord::Base? (readonly)

Returns:

  • (ActiveRecord::Base, nil)


14
15
16
# File 'lib/royal/insufficient_points_error.rb', line 14

def pointable
  @pointable
end

#reasonString? (readonly)

Returns:

  • (String, nil)


12
13
14
# File 'lib/royal/insufficient_points_error.rb', line 12

def reason
  @reason
end