Sha256: 93c48cc54136c57c5d51e7d25d1c4680652eeeaa933d032aee3ba486db85f966

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

class Irwi::Config
  
  attr_accessor_with_default :controller_name, 'wiki_pages'
  
  attr_accessor_with_default :user_class_name, 'User'
  
  attr_accessor_with_default :page_class_name, 'WikiPage'
  attr_accessor_with_default :page_version_class_name, 'WikiPageVersion'
  
  attr_accessor_with_default :page_version_foreign_key, 'page_id'
  
  # Object using to format content
  attr_accessor_with_default :formatter do
    require 'irwi/formatters/red_cloth'

    Irwi::Formatters::RedCloth.new
  end
  
  # Object using to compare pages
  attr_accessor_with_default :comparator do
    require 'irwi/comparators/diff_lcs'

    Irwi::Comparators::DiffLcs.new
  end
  
  # Object using to paginate collections
  attr_accessor_with_default :paginator do
    require 'irwi/paginators/none'

    Irwi::Paginators::None.new
  end
  
  def page_class
    page_class_name.constantize
  end
  
  def page_version_class
    page_version_class_name.constantize
  end
  
  def user_class
    user_class_name.constantize
  end
  
  def system_pages
    @system_pages ||= {
      'all' => 'all'
    }
  end
  
  # Add system page
  # @param action [String,Symbol] controller action
  # @param path [String] path in routes
  def add_system_page( action, path )
    system_pages[ action.to_s ] = path.to_s
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
irwi-0.1.11 lib/irwi/config.rb
irwi-0.1.10 lib/irwi/config.rb
irwi-0.1.9 lib/irwi/config.rb