Skip to content

Commit

Permalink
Adjustments in str and repr
Browse files Browse the repository at this point in the history
  • Loading branch information
lorinkoz committed Jun 26, 2024
1 parent 795d8aa commit 526eec0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/money.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Money {
}

fn __str__(&self) -> String {
self.amount.to_string()
format!("Money('{}')", self.amount)
}

fn __repr__(&self) -> String {
Expand Down
5 changes: 4 additions & 1 deletion src/money_vat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ impl MoneyWithVAT {
}

fn __str__(&self) -> String {
format!("{} {}", self.net.amount, self.tax.amount)
format!(
"MoneyWithVAT(net='{}', tax='{}')",
self.net.amount, self.tax.amount
)
}

fn __repr__(&self) -> String {
Expand Down
5 changes: 4 additions & 1 deletion src/money_vat_ratio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ impl MoneyWithVATRatio {
}

fn __str__(&self) -> String {
format!("{} {}", self.net_ratio, self.gross_ratio)
format!(
"MoneyWithVATRatio(net_ratio='{}', gross_ratio='{}')",
self.net_ratio, self.gross_ratio
)
}

fn __repr__(&self) -> String {
Expand Down

0 comments on commit 526eec0

Please sign in to comment.