Module: Hecks::Bluebook::Behaviour::Attribute

Included in:
Attribute
Defined in:
lib/hecks/bluebook/behaviour/attribute.rb

Overview

WHAT AN ATTRIBUTE DOES. The declared half — name, type, list, default, optional, pattern, admits — is what the language states in aggregate.bluebook's own Field. These are the questions readers ask ABOUT that shape, which no declaration states.

Instance Method Summary collapse

Instance Method Details

#list?Boolean

Returns:

  • (Boolean)


9
# File 'lib/hecks/bluebook/behaviour/attribute.rb', line 9

def list?      = @list

#optional?Boolean

MAY THIS FACT BE LEFT OUT?

Required is the default and by far the common case — a command takes the arguments it declares, and all of them — so the EXCEPTION is what gets marked. Marking the other way would annotate almost every attribute in the corpus to say nothing.

Only a COMMAND enforces this. An aggregate's own attributes are filled by the commands that set them, and a value object's by its constructor ; neither is a payload anyone hands in.

Returns:

  • (Boolean)


23
# File 'lib/hecks/bluebook/behaviour/attribute.rb', line 23

def optional? = @optional

#reference?Boolean

Returns:

  • (Boolean)


11
# File 'lib/hecks/bluebook/behaviour/attribute.rb', line 11

def reference? = @type.is_a?(Reference)

#scalar?Boolean

Returns:

  • (Boolean)


10
# File 'lib/hecks/bluebook/behaviour/attribute.rb', line 10

def scalar?    = !@list