Skip to content

Commit

Permalink
Merge pull request #56 from COBREXA/mk-format-bound-values
Browse files Browse the repository at this point in the history
add pretty support for custom formatting of bound values
  • Loading branch information
stelmo authored Dec 23, 2024
2 parents cfaf651 + 214523c commit 6878c2c
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/pretty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,32 @@ $(TYPEDSIGNATURES)
Pretty-print an equality bound into the `io`.
"""
function pretty(io::IO, x::EqualToT; equal_to_sign = "=", kwargs...)
print(io, " $equal_to_sign $(x.equal_to)")
function pretty(
io::IO,
x::EqualToT;
equal_to_sign = "=",
format_bound_value = string,
kwargs...,
)
print(io, " $equal_to_sign $(format_bound_value(x.equal_to))")
end

"""
$(TYPEDSIGNATURES)
Pretty-print an interval bound into the `io`.
"""
function pretty(io::IO, x::BetweenT; in_interval_sign = "", kwargs...)
print(io, " $in_interval_sign [$(x.lower), $(x.upper)]")
function pretty(
io::IO,
x::BetweenT;
in_interval_sign = "",
format_bound_value = string,
kwargs...,
)
print(
io,
" $in_interval_sign [$(format_bound_value(x.lower)), $(format_bound_value(x.upper))]",
)
end

#
Expand Down

0 comments on commit 6878c2c

Please sign in to comment.