Sha256: c6134a93285e8f36df0b01ce356f535d7aa8667af3ed62e9c7e7c4c414ad0463

Contents?: true

Size: 860 Bytes

Versions: 6

Compression:

Stored size: 860 Bytes

Contents

module DirModel
  module Model
    module Files
      extend ActiveSupport::Concern

      included do
        include InheritedClassVar
        inherited_class_hash :files
      end

      module ClassMethods
        # @return [Array<Symbol>] file names for the row model
        def file_names
          files.keys
        end

        # @param [Symbol] file_name name of file to find option
        # @return [Hash] options for the file_name
        def options(file_name)
          files[file_name]
        end

        # @param [Symbol] file_name name of file to find index
        # @return [Integer] index of the file_name
        def index(file_name)
          file_names.index file_name
        end

        protected

        def file(file_name, options={})
          merge_files(file_name.to_sym => options)
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dir_model-0.4.0 lib/dir_model/model/files.rb
dir_model-0.3.4 lib/dir_model/model/files.rb
dir_model-0.3.3 lib/dir_model/model/files.rb
dir_model-0.3.2 lib/dir_model/model/files.rb
dir_model-0.3.1 lib/dir_model/model/files.rb
dir_model-0.3.0 lib/dir_model/model/files.rb