Class: Ibex::Runtime::SyntaxSessionLimits

Inherits:
Object
  • Object
show all
Defined in:
lib/ibex/runtime/syntax_session.rb

Overview

Immutable syntax-service bounds layered over parser ResourceLimits.

Constant Summary collapse

DEFAULT_MAX_SOURCE_BYTES =

: Integer

16 * 1024 * 1024
DEFAULT_MAX_EDITS_PER_OPERATION =

: Integer

1_024
DEFAULT_MAX_INSERTED_BYTES =

: Integer

4 * 1024 * 1024

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_source_bytes: DEFAULT_MAX_SOURCE_BYTES, max_edits_per_operation: DEFAULT_MAX_EDITS_PER_OPERATION, max_inserted_bytes: DEFAULT_MAX_INSERTED_BYTES) ⇒ SyntaxSessionLimits

Returns a new instance of SyntaxSessionLimits.



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ibex/runtime/syntax_session.rb', line 76

def initialize(
  max_source_bytes: DEFAULT_MAX_SOURCE_BYTES,
  max_edits_per_operation: DEFAULT_MAX_EDITS_PER_OPERATION,
  max_inserted_bytes: DEFAULT_MAX_INSERTED_BYTES
)
  validate_positive_integer(max_source_bytes, :max_source_bytes)
  validate_positive_integer(max_edits_per_operation, :max_edits_per_operation)
  validate_nonnegative_integer(max_inserted_bytes, :max_inserted_bytes)
  @max_source_bytes = max_source_bytes
  @max_edits_per_operation = max_edits_per_operation
  @max_inserted_bytes = max_inserted_bytes
  freeze
end

Instance Attribute Details

#max_edits_per_operationObject (readonly)

: Integer



71
72
73
# File 'lib/ibex/runtime/syntax_session.rb', line 71

def max_edits_per_operation
  @max_edits_per_operation
end

#max_inserted_bytesObject (readonly)

: Integer



72
73
74
# File 'lib/ibex/runtime/syntax_session.rb', line 72

def max_inserted_bytes
  @max_inserted_bytes
end

#max_source_bytesObject (readonly)

: Integer



70
71
72
# File 'lib/ibex/runtime/syntax_session.rb', line 70

def max_source_bytes
  @max_source_bytes
end