Class: Typescript::Monkey::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/typescript/monkey/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/typescript/monkey/configuration.rb', line 18

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

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



16
17
18
# File 'lib/typescript/monkey/configuration.rb', line 16

def logger
  @logger
end

#optionsObject

Returns the value of attribute options.



15
16
17
# File 'lib/typescript/monkey/configuration.rb', line 15

def options
  @options
end

Instance Method Details

#compile=(value) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/typescript/monkey/configuration.rb', line 35

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

#default_optionsObject



31
32
33
# File 'lib/typescript/monkey/configuration.rb', line 31

def default_options
  @_default_options.to_enum
end