Sha256: 86ac49f59d2a7e4132f2ea590dce5470b0a57eab693475162a65be6e60e696f2

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

module Schnitzelpress
  class Config
    include Mongoid::Document
    include Mongoid::Timestamps
    identity :type => String
    store_in :config

    field :blog_title, :type => String, :default => "A New Schnitzelpress Blog"
    field :blog_description, :type => String, :default => ""
    field :blog_footer, :type => String, :default => "powered by [Schnitzelpress](http://schnitzelpress.org)"
    field :blog_feed_url, :type => String, :default => "/blog.atom"

    field :author_name, :type => String, :default => "Joe Schnitzel"

    field :disqus_id, :type => String
    field :google_analytics_id, :type => String
    field :gauges_id, :type => String
    field :gosquared_id, :type => String
    field :twitter_id, :type => String

    field :cache_timestamp, :type => DateTime

    validates :blog_title, :author_name, :presence => true

    class << self
      def instance
        @@instance ||= find_or_create_by(:id => 'schnitzelpress')
      end

      def forget_instance
        @@instance = nil
      end

      def get(k)
        instance.send(k)
      end

      def set(k, v)
        instance.update_attributes!(k => v)
        v
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
schnitzelpress-0.2.1 lib/schnitzelpress/config.rb