Class: J::Short

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



65
66
67
# File 'lib/affidavit/j.rb', line 65

def args
  @args
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



65
66
67
# File 'lib/affidavit/j.rb', line 65

def label
  @label
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



65
66
67
# File 'lib/affidavit/j.rb', line 65

def 
  
end

#operationObject

Returns the value of attribute operation

Returns:

  • (Object)

    the current value of operation



65
66
67
# File 'lib/affidavit/j.rb', line 65

def operation
  @operation
end

#receiverObject

Returns the value of attribute receiver

Returns:

  • (Object)

    the current value of receiver



65
66
67
# File 'lib/affidavit/j.rb', line 65

def receiver
  @receiver
end

Instance Method Details

#as_jsonObject



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/affidavit/j.rb', line 71

def as_json(...)
  resolve

  {
    value: value,
    label: label,
    metadata: ,
    spec: {
      operation: operation,
      inspected: @inspected.as_json(...),
    }
  }
end

#resolveObject



85
86
87
88
89
90
91
92
93
94
# File 'lib/affidavit/j.rb', line 85

def resolve
  return if defined?(@value)

  @inspected = []
  @value = receiver.public_send(operation) { |c|
    @inspected << c
    c.value
  }

end

#valueObject



66
67
68
69
# File 'lib/affidavit/j.rb', line 66

def value
  resolve
  @value
end