lib/gistcafe.rb in gistcafe-0.1.0 vs lib/gistcafe.rb in gistcafe-0.1.1
- old
+ new
@@ -97,13 +97,13 @@
puts dump_table(obj)
end
def self.align_left(str, len, pad=" ")
return "" if len < 0
- a_len = len + 1 + str.length
+ a_len = len + 1 - str.length
return str if a_len <= 0
- "#{pad}#{str}#{pad * (len + 1 - str.length)}"
+ "#{pad}#{str}#{pad * a_len}"
end
def self.align_center(str, len, pad=" ")
return "" if len < 0
str = "" if str.nil?
@@ -113,12 +113,12 @@
"#{pad * (half + 1)}#{str}#{pad * (half + 1 + odds)}"
end
def self.align_right(str, len, pad=" ")
return "" if len < 0
- a_len = len + 1 + str.length
+ a_len = len + 1 - str.length
return str if a_len <= 0
- "#{pad * (len + 1 - str.length)}#{str}#{pad}"
+ "#{pad * a_len}#{str}#{pad}"
end
def self.align_auto(obj, len, pad=" ")
str = "#{obj}"
if str.length <= len