Sha256: 82390266e3ef5744e208c9f6e64b3e3558b8878c6be3dd9d2157d7ded6a29af7

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

# @private
module Skyline::Content
  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

1 entries across 1 versions & 1 rubygems

Version Path
skylinecms-3.0.7 lib/skyline/content/exportable.rb