Class: CSVPlusPlus::Entities::RuntimeValue

Inherits:
Entity
  • Object
show all
Defined in:
lib/csv_plus_plus/entities/runtime_value.rb

Overview

A runtime value. These are values which can be materialized at any point via the resolve_fn which takes an ExecutionContext as a param

Instance Attribute Summary collapse

Attributes inherited from Entity

#id, #type

Instance Method Summary collapse

Methods inherited from Entity

#==, #method_missing, #respond_to_missing?

Constructor Details

#initialize(resolve_fn, arguments: nil) ⇒ RuntimeValue

Returns a new instance of RuntimeValue.

Parameters:

  • resolve_fn (lambda)

    A lambda that is called when the runtime value is resolved



13
14
15
16
17
18
# File 'lib/csv_plus_plus/entities/runtime_value.rb', line 13

def initialize(resolve_fn, arguments: nil)
  super(:runtime_value)

  @arguments = arguments
  @resolve_fn = resolve_fn
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CSVPlusPlus::Entities::Entity

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



10
11
12
# File 'lib/csv_plus_plus/entities/runtime_value.rb', line 10

def arguments
  @arguments
end

#resolve_fnlambda (readonly)

A lambda that is called when the runtime value is resolved

Returns:

  • (lambda)

    the current value of resolve_fn



9
10
11
# File 'lib/csv_plus_plus/entities/runtime_value.rb', line 9

def resolve_fn
  @resolve_fn
end

Instance Method Details

#to_sString

Returns:



21
22
23
# File 'lib/csv_plus_plus/entities/runtime_value.rb', line 21

def to_s
  '(runtime_value)'
end