Class: Hecks::Forms::Field

Inherits:
Struct
  • Object
show all
Defined in:
lib/hecks/forms/field_shape.rb

Overview

One resolved field, ready for a renderer to turn into markup. A LEAF scalar carries kind/options/etc; a :group or :list carries children instead and nothing else on itself.

path is the DOTTED field path this attribute is reached at — "email.address", "amount.cents" — the same convention the language already uses for a query's own cross-object where clauses (where(:"customer.status" => ...)), not a fresh one invented here. A command receives its arguments as nested hashes (email: {address: "..."}), so Params.unflatten (params.rb) walks this same dotted spelling back apart on submit — one convention, two directions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#childrenObject

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def children
  @children
end

#defaultObject

Returns the value of attribute default

Returns:

  • (Object)

    the current value of default



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def default
  @default
end

#helpObject

Returns the value of attribute help

Returns:

  • (Object)

    the current value of help



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def help
  @help
end

#html_typeObject

Returns the value of attribute html_type

Returns:

  • (Object)

    the current value of html_type



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def html_type
  @html_type
end

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def kind
  @kind
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def label
  @label
end

#optionalObject

Returns the value of attribute optional

Returns:

  • (Object)

    the current value of optional



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def optional
  @optional
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def options
  @options
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def path
  @path
end

#patternObject

Returns the value of attribute pattern

Returns:

  • (Object)

    the current value of pattern



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def pattern
  @pattern
end

#stepObject

Returns the value of attribute step

Returns:

  • (Object)

    the current value of step



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def step
  @step
end

#target_aggregateObject

Returns the value of attribute target_aggregate

Returns:

  • (Object)

    the current value of target_aggregate



18
19
20
# File 'lib/hecks/forms/field_shape.rb', line 18

def target_aggregate
  @target_aggregate
end

Instance Method Details

#leaf?Boolean

Returns:

  • (Boolean)


22
# File 'lib/hecks/forms/field_shape.rb', line 22

def leaf? = kind != :group && kind != :list

#optional?Boolean

Returns:

  • (Boolean)


23
# File 'lib/hecks/forms/field_shape.rb', line 23

def optional? = optional

#required?Boolean

Returns:

  • (Boolean)


24
# File 'lib/hecks/forms/field_shape.rb', line 24

def required? = !optional