Class: Tableasy::FormattersContext

Inherits:
Object
  • Object
show all
Defined in:
lib/tableasy.rb

Class Method Summary collapse

Class Method Details

.formatter(name, options = {}, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tableasy.rb', line 11

def self.formatter(name, options = {}, &block)
  Formatter.new(&block).tap do |formatter|
    formatter.format_header { nil } if options.delete(:no_header)

    FormattersHelper.module_eval do
      define_method(name) do |column, *args|
        Formatter::Column.new(self, formatter, column, *args.push(options))
      end
    end
  end
end