Skip to content

Commit

Permalink
Move string justification defaults to the function heads
Browse files Browse the repository at this point in the history
  • Loading branch information
lexmag committed Oct 28, 2014
1 parent d472105 commit c49b5c5
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/elixir/lib/string.ex
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,7 @@ defmodule String do
@spec rjust(t, non_neg_integer) :: t
@spec rjust(t, non_neg_integer, char) :: t

def rjust(subject, len) do
rjust(subject, len, ?\s)
end

def rjust(subject, len, pad) when is_integer(pad) and is_integer(len) and len >= 0 do
def rjust(subject, len, pad \\ ?\s) when is_integer(pad) and is_integer(len) and len >= 0 do
do_justify(subject, len, pad, :right)
end

Expand All @@ -607,11 +603,7 @@ defmodule String do
@spec ljust(t, non_neg_integer) :: t
@spec ljust(t, non_neg_integer, char) :: t

def ljust(subject, len) do
ljust(subject, len, ?\s)
end

def ljust(subject, len, pad) when is_integer(pad) and is_integer(len) and len >= 0 do
def ljust(subject, len, pad \\ ?\s) when is_integer(pad) and is_integer(len) and len >= 0 do
do_justify(subject, len, pad, :left)
end

Expand Down

0 comments on commit c49b5c5

Please sign in to comment.