Module: Hecks::Bluebook::Behaviour::Mutation

Included in:
Mutation
Defined in:
lib/hecks/bluebook/behaviour/command.rb

Overview

A MUTATION'S OWN READINGS. Included (not extended) — Mutation is a Struct, so these are instance methods.

Instance Method Summary collapse

Instance Method Details

#appended_fieldsObject

An APPEND binds several fields at once, each from either a command ARGUMENT (a Symbol) or a LITERAL. It used to spell the Symbol bare and inspect the rest, which is the opposite of what a where-clause did with the same two kinds — see Hecks::Literal.



102
# File 'lib/hecks/bluebook/behaviour/command.rb', line 102

def appended_fields = source.transform_values { |value| Literal.render(value) }

#classified_sourceObject



104
105
106
107
108
109
110
111
112
# File 'lib/hecks/bluebook/behaviour/command.rb', line 104

def classified_source
  if source.is_a?(Symbol)
    { kind: "argument", name: source.to_s }
  elsif source.is_a?(StateRef)
    { kind: "state", name: source.name.to_s }
  else
    { kind: "literal", value: source }
  end
end