lib/formatting.rb in surpass-0.0.3 vs lib/formatting.rb in surpass-0.0.4

- old
+ new

@@ -216,10 +216,11 @@ else @colour_index = new_colour end end alias :color= :colour= + alias :color_index= :colour_index= def to_biff options = PLAIN options |= BOLD if @bold options |= ITALIC if @italic @@ -403,10 +404,14 @@ def self.line_type_directives LINE_TYPE_DIRECTIVES.collect {|k, v| k} end + def self.line_type_constants + LINE_TYPE_DIRECTIVES.collect {|k, v| v} + end + def initialize(hash = {}) @left = NO_LINE @right = NO_LINE @top = NO_LINE @bottom = NO_LINE @@ -439,10 +444,11 @@ else args = [directives] # there's just 1 here, stick it in an array end raise "no directives given to process_directives" if args.empty? # maybe don't need this, just get thin black border? but for development I want to know if this happens. + raise "too many directives given to process_directives" if args.size > 2 instructions = [THIN, Formatting::COLOURS['black']] args.each do |a| if Formatting::COLOURS.include?(a) instructions[1] = Formatting::COLOURS[a] @@ -450,9 +456,14 @@ end if Borders.line_type_directives.include?(a) line_type_directives_hash = Hash[*LINE_TYPE_DIRECTIVES.flatten] instructions[0] = line_type_directives_hash[a] + next + end + + if Borders.line_type_constants.include?(a) + instructions[0] = a next end raise "I don't know how to format a border with #{a.inspect}." end