
Submitted by transami (Sun Aug 28 14:24:02 UTC 2005)
A minor incompatability arises if the deault seperator is "\n" as I think it likely would best be. Also perhpas the seperator parameter should come before the buffer string parameter.
(P.S. If otherwise rejected what would should the corresponding methods be called?)
alias_method :rjust_whole, :rjust
def rjust(n,c=' ',sep="\n")
return rjust_whole(n,c) unless sep
q = split(sep.to_s).collect { |line|
line.rjust_whole(n,c)
}
q.join(sep.to_s)
end

| Comments | Current voting | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|


RCRchive copyright © David Alan Black, 2003-2005.
Powered by .