Sha256: 25e922d1d430395467d2d81718545a6a650ad2188e40de099b301ecf7a6b93b4

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

require 'active_support/configurable'

module Snipp

  def self.configure(&block)
    yield @config ||= Snipp::Configuration.new
  end

  def self.config
    @config
  end

  class Configuration #:nodoc:
    include ActiveSupport::Configurable
    config_accessor :root_url, :markup, :html_meta_tags

    def param_name
      config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
    end

    # define param_name writer (copied from AS::Configurable)
    writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
    singleton_class.class_eval writer, __FILE__, line
    class_eval writer, __FILE__, line
  end

  configure do |config|
    config.markup         = :microdata
    config.html_meta_tags = {
      title:       '',
      description: '',
      keywords:    '',
      og: {
        site_name:   '',
        type:        'article',
        title:       '',
        description: '',
        image:       ''
      },
      author:      '',
      robots:      ['index,follow', 'noodp', 'noydir'],
      viewport:    'width=device-width'
    }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snipp-0.1.3 lib/snipp/config.rb
snipp-0.1.2 lib/snipp/config.rb
snipp-0.1.1 lib/snipp/config.rb
snipp-0.1.0 lib/snipp/config.rb