Class: Low::LocalProxy

Inherits:
Object show all
Includes:
ErrorHandling
Defined in:
lib/proxies/local_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ErrorHandling

#backtrace, #output

Constructor Details

#initialize(type_expression:, name:, file_path:, start_line:, scope:) ⇒ LocalProxy

Returns a new instance of LocalProxy.



12
13
14
15
16
17
18
19
# File 'lib/proxies/local_proxy.rb', line 12

def initialize(type_expression:, name:, file_path:, start_line:, scope:)
  @file_path = file_path
  @start_line = start_line
  @scope = scope

  @type_expression = type_expression
  @name = name
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



10
11
12
# File 'lib/proxies/local_proxy.rb', line 10

def file_path
  @file_path
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/proxies/local_proxy.rb', line 10

def name
  @name
end

#scopeObject (readonly)

Returns the value of attribute scope.



10
11
12
# File 'lib/proxies/local_proxy.rb', line 10

def scope
  @scope
end

#start_lineObject (readonly)

Returns the value of attribute start_line.



10
11
12
# File 'lib/proxies/local_proxy.rb', line 10

def start_line
  @start_line
end

#type_expressionObject (readonly)

Returns the value of attribute type_expression.



10
11
12
# File 'lib/proxies/local_proxy.rb', line 10

def type_expression
  @type_expression
end

Instance Method Details

#error_message(value:) ⇒ Object



25
26
27
# File 'lib/proxies/local_proxy.rb', line 25

def error_message(value:)
  "Invalid variable type #{output(value:)} in '#{name.class}:#{@start_line}'. Valid types: '#{type_expression.valid_types}'"
end

#error_typeObject



21
22
23
# File 'lib/proxies/local_proxy.rb', line 21

def error_type
  LocalTypeError
end