lib/terminal-table/cell.rb in visionmedia-terminal-table-1.0.4 vs lib/terminal-table/cell.rb in visionmedia-terminal-table-1.0.5

- old
+ new

@@ -1,27 +1,17 @@ module Terminal class Table class Cell - DEFAULT_ALIGNMENT = :left - attr_accessor :value, :alignment - def initialize render_length, initial = nil - @render_length = render_length - case initial - when Hash - @value = initial[:value] - @alignment = initial[:align] unless initial[:align].nil? - when - @value = initial - @alignment = DEFAULT_ALIGNMENT - end + def initialize width, value = nil, alignment = :left + @width, @alignment, @value = width, alignment, value end def render - " #{value.to_s} ".align alignment, @render_length + 2 + " #{value.to_s} ".align alignment, @width + 2 end alias :to_s :render def length value.to_s.length + 2 \ No newline at end of file