Sha256: d3e84dbbc9cee585b7bf80d1bdbf1b1adea090581d9aa447d98a2307c16410b7

Contents?: true

Size: 694 Bytes

Versions: 3

Compression:

Stored size: 694 Bytes

Contents

require 'annotator/initial_description/base'
Dir[File.dirname(__FILE__) + '/initial_description/*.rb'].each {|file| require file }

module Annotator
  module InitialDescription

    NO_DESCRIPTION_COLUMNS = %w{email name title body} 

    # Get initial description for given model & column
    def self.for(model, column)
      # Check if any module provides such description
      Base.providers.each do |klass|
        provider = klass.new model, column
        return provider.text if provider.check
      end
      # Some columns are just too obvious
      return "" if NO_DESCRIPTION_COLUMNS.include? column
      # Let user do the work
      return "TODO: document me"
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
annotator-0.0.7 lib/annotator/initial_description.rb
annotator-0.0.6 lib/annotator/initial_description.rb
annotator-0.0.5 lib/annotator/initial_description.rb