Sha256: 70348d551db52ae083563479c8b73c4f0619c727aecb916bae7bf96ae2cabf4e

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

# Todo: rewrite
module Snowball
  class Config
    class Builder
      def initialize(config = {})
        @config = config
        @config[:extensions] ||= [:js, :coffee]
        @config[:source_paths] ||= []
        @config[:raw] ||= []
        @config[:source] ||= []
        @config[:includes] ||= []
        @config[:ignores] = []
        @config[:env] ||= {}
        @config[:prelude] ||= true
      end
      def http_path(path)
        @config[:http_path] = path
      end
      alias_method :set_serve_path, :http_path # todo: deprecate
      def source_path(path)
        @config[:source_paths] << File.expand_path(path)
      end

      alias_method :add_load_path, :source_path # todo: deprecate
      def raw(glob_string)
        @config[:raw] << glob_string
      end

      def source(glob_string)
        @config[:source] << glob_string
      end

      def ignore(node_module)
        @config[:ignores] << node_module
      end

      def setenv(*args)
        @config[:env].merge!(args.first) and return if args.size == 1
        @config[:env][args.first] = args[1]
      end

      def include(node_module)
        @config[:includes] << node_module
      end

      def prelude(bool)
        @config[:prelude] = bool
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
snowball-0.1.22 lib/snowball/config.rb
snowball-0.1.21 lib/snowball/config.rb
snowball-0.1.20 lib/snowball/config.rb
snowball-0.1.9 lib/snowball/config.rb
snowball-0.1.8 lib/snowball/config.rb
snowball-0.1.7 lib/snowball/config.rb
snowball-0.1.6 lib/snowball/config.rb