lib/intuition/sheet.rb in intuition-0.0.1.alpha1 vs lib/intuition/sheet.rb in intuition-0.0.1.alpha2

- old
+ new

@@ -4,10 +4,11 @@ class Sheet attr_reader :title def initialize(title) @title = title + @conversions = Hash.new([]) end def header(*value) if value.any? @header = [value].flatten @@ -29,13 +30,19 @@ end end @table end + def conversion(type, &block) + @conversions[type] ||= [] + @conversions[type] << Proc.new(&block) + end + def full_table [header] + table.rows end - def run_conversions(*args) + def run_conversions(type, args) + @conversions[type].each{|c| c.call(self, args) } end end end