Class: Clerk::Models::Components::Totals

Inherits:
Object
  • Object
show all
Includes:
Crystalline::MetadataFields
Defined in:
lib/clerk/models/components/totals.rb

Overview

Totals for the statement.

Instance Method Summary collapse

Methods included from Crystalline::MetadataFields

#field, #fields, included, #marshal_single, #to_dict, #to_json

Constructor Details

#initialize(grand_total:, subtotal:, tax_total:) ⇒ Totals

Returns a new instance of Totals.



23
24
25
26
27
# File 'lib/clerk/models/components/totals.rb', line 23

def initialize(grand_total:, subtotal:, tax_total:)
  @grand_total = grand_total
  @subtotal = subtotal
  @tax_total = tax_total
end

Instance Method Details

#==(other) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/clerk/models/components/totals.rb', line 30

def ==(other)
  return false unless other.is_a? self.class
  return false unless @grand_total == other.grand_total
  return false unless @subtotal == other.subtotal
  return false unless @tax_total == other.tax_total
  true
end