Sha256: 84cfee12aa6f9ec96f712644fb4196f56a65a7295ac21ea5be41d6b49f456d9d

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'typescript/monkey/package'

module Typescript::Monkey
  class << self
    attr_accessor :configuration
  end

  def self.configure(&block)
    self.configuration ||= Configuration.new
    block.call(configuration) if block_given?
  end

  class Configuration

    attr_accessor :options
    attr_accessor :logger

    def initialize
      @_default_options = [
        "--target es5",
        "--outFile /dev/stdout",
        "--noResolve",
        "--removeComments",
        "--typeRoots ['#{File.expand_path("../lib", Typescript::Monkey::Package.metadata_path())}']"
      ]
      @options = @_default_options.to_set
      @compile = false;
      @logger = nil;
    end

    def default_options
      @_default_options.to_enum
    end

    def compile=(value)
      unless (!!value == value)
        raise TypeError, "#{method(__method__).owner}.#{__method__}: value parameter must be type Bool"
      end

      if value == true
        @options.delete("--noResolve")
        @compile = true
      else
        @options.add("--noResolve")
        @compile = false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typescript-monkey-0.9.0 lib/typescript/monkey/configuration.rb