Class: J::Expression

Inherits:
Struct
  • Object
show all
Defined in:
lib/affidavit/j.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



40
41
42
# File 'lib/affidavit/j.rb', line 40

def args
  @args
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



40
41
42
# File 'lib/affidavit/j.rb', line 40

def label
  @label
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



40
41
42
# File 'lib/affidavit/j.rb', line 40

def 
  
end

#operationObject

Returns the value of attribute operation

Returns:

  • (Object)

    the current value of operation



40
41
42
# File 'lib/affidavit/j.rb', line 40

def operation
  @operation
end

#receiverObject

Returns the value of attribute receiver

Returns:

  • (Object)

    the current value of receiver



40
41
42
# File 'lib/affidavit/j.rb', line 40

def receiver
  @receiver
end

Instance Method Details

#__is__J__Object



47
48
49
# File 'lib/affidavit/j.rb', line 47

def __is__J__
  true
end

#as_jsonObject



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/affidavit/j.rb', line 51

def as_json(...)
  {
    value: value,
    label: label,
    metadata: ,
    spec: {
      receiver: receiver.as_json(...),
      operation: operation.as_json(...),
      args: args.map { _1.as_json(...) }
    }
  }
end

#valueObject



41
42
43
44
45
# File 'lib/affidavit/j.rb', line 41

def value
  return @value if defined?(@value)

  @value = J.reify(receiver).public_send(J.reify(operation), *args.map { J.reify(_1) })
end