Sha256: 2e4d0817ceee9e0eafe60d132c57448d08a64d9bf7d5edd4fe320a24200fde6f

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

require 'stringio'
require 'uri'

module Parklife
  class Config
    DEFAULT_HOST = 'example.com'
    DEFAULT_SCHEME = 'http'

    attr_accessor :app, :build_dir, :nested_index, :on_404, :reporter
    attr_reader :base

    def initialize
      self.base = nil
      self.build_dir = 'build'
      self.nested_index = true
      self.on_404 = :error
      self.reporter = StringIO.new
    end

    def base=(value)
      uri = URI.parse(value || '')
      uri.host ||= DEFAULT_HOST
      uri.scheme ||= DEFAULT_SCHEME
      @base = uri
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parklife-0.4.0 lib/parklife/config.rb
parklife-0.3.0 lib/parklife/config.rb