Class: Typelizer::RouteConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/typelizer/route_config.rb,
lib/typelizer/route_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#camel_caseObject

Returns the value of attribute camel_case

Returns:

  • (Object)

    the current value of camel_case



4
5
6
# File 'lib/typelizer/route_config.rb', line 4

def camel_case
  @camel_case
end

#enabledObject

Returns the value of attribute enabled

Returns:

  • (Object)

    the current value of enabled



4
5
6
# File 'lib/typelizer/route_config.rb', line 4

def enabled
  @enabled
end

#excludeObject

Returns the value of attribute exclude

Returns:

  • (Object)

    the current value of exclude



4
5
6
# File 'lib/typelizer/route_config.rb', line 4

def exclude
  @exclude
end

#formatObject

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



4
5
6
# File 'lib/typelizer/route_config.rb', line 4

def format
  @format
end

#includeObject

Returns the value of attribute include

Returns:

  • (Object)

    the current value of include



4
5
6
# File 'lib/typelizer/route_config.rb', line 4

def include
  @include
end

#output_dirObject

Returns the value of attribute output_dir

Returns:

  • (Object)

    the current value of output_dir



4
5
6
# File 'lib/typelizer/route_config.rb', line 4

def output_dir
  @output_dir
end

Class Method Details

.build(**overrides) ⇒ Object



38
39
40
# File 'lib/typelizer/route_config.rb', line 38

def self.build(**overrides)
  new(**defaults.merge(overrides))
end

.defaultsObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/typelizer/route_config.rb', line 15

def self.defaults
  {
    enabled: false,
    output_dir: nil,
    include: nil,
    exclude: nil,
    camel_case: true,
    format: :ts
  }
end

Instance Method Details

#file_extObject



34
35
36
# File 'lib/typelizer/route_config.rb', line 34

def file_ext
  js? ? "js" : "ts"
end

#js?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/typelizer/route_config.rb', line 30

def js?
  format == :js
end

#ts?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/typelizer/route_config.rb', line 26

def ts?
  format != :js
end