OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/models/work_package/exporter/formatters.rb

26 lines
592 B

module WorkPackage::Exporter
module Formatters
def self.all
@formatters ||= begin
%i[default costs estimated_hours].map do |key|
Kernel.const_get("WorkPackage::Exporter::Formatters::#{key.to_s.camelize}")
end
end
end
def self.keys
all.map(&:key)
end
def self.register(clz)
@formatters << clz
end
##
# Returns a matching formatter for the given query column
def self.for_column(column)
formatter = all.find { |formatter| formatter.apply? column } || Default
formatter.new
end
end
end