Class: Herb::ParserOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/herb/parser_options.rb,
sig/herb/parser_options.rbs,
ext/herb/extension.c

Constant Summary collapse

DEFAULT_STRICT =

: bool

Returns:

  • (Boolean)
true
DEFAULT_TRACK_WHITESPACE =

: bool

Returns:

  • (Boolean)
false
DEFAULT_ANALYZE =

: bool

Returns:

  • (Boolean)
true
DEFAULT_ACTION_VIEW_HELPERS =

: bool

Returns:

  • (Boolean)
false
DEFAULT_TRANSFORM_CONDITIONALS =

: bool

Returns:

  • (Boolean)
false
DEFAULT_RENDER_NODES =

: bool

Returns:

  • (Boolean)
false
DEFAULT_STRICT_LOCALS =

: bool

Returns:

  • (Boolean)
false
DEFAULT_PRISM_PROGRAM =

: bool

Returns:

  • (Boolean)
false
DEFAULT_PRISM_NODES =

: bool

Returns:

  • (Boolean)
false
DEFAULT_PRISM_NODES_DEEP =

: bool

Returns:

  • (Boolean)
false
DEFAULT_TIMEOUT =

: Numeric

Returns:

  • (Numeric)
1
DEFAULT_MAX_ERRORS =

: Integer

Returns:

  • (Integer)
25

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strict: DEFAULT_STRICT, track_whitespace: DEFAULT_TRACK_WHITESPACE, analyze: DEFAULT_ANALYZE, action_view_helpers: DEFAULT_ACTION_VIEW_HELPERS, transform_conditionals: DEFAULT_TRANSFORM_CONDITIONALS, render_nodes: DEFAULT_RENDER_NODES, strict_locals: DEFAULT_STRICT_LOCALS, prism_nodes: DEFAULT_PRISM_NODES, prism_nodes_deep: DEFAULT_PRISM_NODES_DEEP, prism_program: DEFAULT_PRISM_PROGRAM, timeout: DEFAULT_TIMEOUT, max_errors: DEFAULT_MAX_ERRORS) ⇒ ParserOptions

: (?strict: bool, ?track_whitespace: bool, ?analyze: bool, ?action_view_helpers: bool, ?transform_conditionals: bool, ?render_nodes: bool, ?strict_locals: bool, ?prism_nodes: bool, ?prism_nodes_deep: bool, ?prism_program: bool, ?timeout: Numeric) -> void

Parameters:

  • strict: (Boolean) (defaults to: DEFAULT_STRICT)
  • track_whitespace: (Boolean) (defaults to: DEFAULT_TRACK_WHITESPACE)
  • analyze: (Boolean) (defaults to: DEFAULT_ANALYZE)
  • action_view_helpers: (Boolean) (defaults to: DEFAULT_ACTION_VIEW_HELPERS)
  • transform_conditionals: (Boolean) (defaults to: DEFAULT_TRANSFORM_CONDITIONALS)
  • render_nodes: (Boolean) (defaults to: DEFAULT_RENDER_NODES)
  • strict_locals: (Boolean) (defaults to: DEFAULT_STRICT_LOCALS)
  • prism_nodes: (Boolean) (defaults to: DEFAULT_PRISM_NODES)
  • prism_nodes_deep: (Boolean) (defaults to: DEFAULT_PRISM_NODES_DEEP)
  • prism_program: (Boolean) (defaults to: DEFAULT_PRISM_PROGRAM)
  • timeout: (Numeric) (defaults to: DEFAULT_TIMEOUT)


32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/herb/parser_options.rb', line 32

def initialize(strict: DEFAULT_STRICT, track_whitespace: DEFAULT_TRACK_WHITESPACE, analyze: DEFAULT_ANALYZE, action_view_helpers: DEFAULT_ACTION_VIEW_HELPERS, transform_conditionals: DEFAULT_TRANSFORM_CONDITIONALS, render_nodes: DEFAULT_RENDER_NODES, strict_locals: DEFAULT_STRICT_LOCALS, prism_nodes: DEFAULT_PRISM_NODES, prism_nodes_deep: DEFAULT_PRISM_NODES_DEEP, prism_program: DEFAULT_PRISM_PROGRAM, timeout: DEFAULT_TIMEOUT, max_errors: DEFAULT_MAX_ERRORS)
  @strict = strict
  @track_whitespace = track_whitespace
  @analyze = analyze
  @action_view_helpers = action_view_helpers
  @transform_conditionals = transform_conditionals
  @render_nodes = render_nodes
  @strict_locals = strict_locals
  @prism_nodes = prism_nodes
  @prism_nodes_deep = prism_nodes_deep
  @prism_program = prism_program
  @timeout = timeout
  @max_errors = max_errors
end

Instance Attribute Details

#action_view_helpersBoolean (readonly)

: bool

Returns:

  • (Boolean)


8
9
10
# File 'lib/herb/parser_options.rb', line 8

def action_view_helpers
  @action_view_helpers
end

#analyzeBoolean (readonly)

: bool

Returns:

  • (Boolean)


7
8
9
# File 'lib/herb/parser_options.rb', line 7

def analyze
  @analyze
end

#max_errorsInteger? (readonly)

: Integer?

Returns:

  • (Integer, nil)


16
17
18
# File 'lib/herb/parser_options.rb', line 16

def max_errors
  @max_errors
end

#prism_nodesBoolean (readonly)

: bool

Returns:

  • (Boolean)


13
14
15
# File 'lib/herb/parser_options.rb', line 13

def prism_nodes
  @prism_nodes
end

#prism_nodes_deepBoolean (readonly)

: bool

Returns:

  • (Boolean)


14
15
16
# File 'lib/herb/parser_options.rb', line 14

def prism_nodes_deep
  @prism_nodes_deep
end

#prism_programBoolean (readonly)

: bool

Returns:

  • (Boolean)


12
13
14
# File 'lib/herb/parser_options.rb', line 12

def prism_program
  @prism_program
end

#render_nodesBoolean (readonly)

: bool

Returns:

  • (Boolean)


10
11
12
# File 'lib/herb/parser_options.rb', line 10

def render_nodes
  @render_nodes
end

#strictBoolean (readonly)

: bool

Returns:

  • (Boolean)


5
6
7
# File 'lib/herb/parser_options.rb', line 5

def strict
  @strict
end

#strict_localsBoolean (readonly)

: bool

Returns:

  • (Boolean)


11
12
13
# File 'lib/herb/parser_options.rb', line 11

def strict_locals
  @strict_locals
end

#timeoutNumeric (readonly)

: Numeric

Returns:

  • (Numeric)


15
16
17
# File 'lib/herb/parser_options.rb', line 15

def timeout
  @timeout
end

#track_whitespaceBoolean (readonly)

: bool

Returns:

  • (Boolean)


6
7
8
# File 'lib/herb/parser_options.rb', line 6

def track_whitespace
  @track_whitespace
end

#transform_conditionalsBoolean (readonly)

: bool

Returns:

  • (Boolean)


9
10
11
# File 'lib/herb/parser_options.rb', line 9

def transform_conditionals
  @transform_conditionals
end

Instance Method Details

#inspectString

: () -> String

Returns:

  • (String)


66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/herb/parser_options.rb', line 66

def inspect
  "#<#{self.class.name}\n  " \
    "strict=#{@strict}\n  " \
    "track_whitespace=#{@track_whitespace}\n  " \
    "analyze=#{@analyze}\n  " \
    "action_view_helpers=#{@action_view_helpers}\n  " \
    "transform_conditionals=#{@transform_conditionals}\n  " \
    "render_nodes=#{@render_nodes}\n  " \
    "strict_locals=#{@strict_locals}\n  " \
    "prism_nodes=#{@prism_nodes}\n  " \
    "prism_nodes_deep=#{@prism_nodes_deep}\n  " \
    "prism_program=#{@prism_program}\n  " \
    "timeout=#{@timeout}\n  " \
    "max_errors=#{@max_errors}>"
end

#to_hHash[Symbol, bool | Numeric | nil]

: () -> Hash[Symbol, (bool | Numeric | nil)]

Returns:

  • (Hash[Symbol, bool | Numeric | nil])


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/herb/parser_options.rb', line 48

def to_h
  {
    strict: @strict,
    track_whitespace: @track_whitespace,
    analyze: @analyze,
    action_view_helpers: @action_view_helpers,
    transform_conditionals: @transform_conditionals,
    render_nodes: @render_nodes,
    strict_locals: @strict_locals,
    prism_nodes: @prism_nodes,
    prism_nodes_deep: @prism_nodes_deep,
    prism_program: @prism_program,
    timeout: @timeout,
    max_errors: @max_errors,
  }
end