Sha256: 80acc342f42b7b19d3d625602f049fb5d3755bc11c0fded2f1baf4fefde3c7bf

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

module Skyline::Content
  # @private
  module Exportable
    
    # List of possible export formats for this class
    def export_formats
      read_inheritable_attribute(:export_formats) || []
    end      
    
    # Set a list of possible export format for this class
    # [DOC]
    def exportable_as(*formats)
      # discard any options for now
      options = formats.pop if formats.last.kind_of? Hash

      formats.each do |format|
        class << self; self; end.send(:define_method, "export_#{format}"){}
      end
      if formats.any?
        write_inheritable_attribute(:export_formats,formats)
        class << self; self; end.send(:define_method,:exportable?) do
          true
        end
      end
    end
    
  end # Exportable
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
skylinecms-3.2.0 lib/skyline/content/exportable.rb
skylinecms-3.1.0 lib/skyline/content/exportable.rb
westarete-skylinecms-3.0.8.20100329 lib/skyline/content/exportable.rb
westarete-skylinecms-3.0.8.20100330 lib/skyline/content/exportable.rb
skylinecms-3.0.8 lib/skyline/content/exportable.rb