Class: RivetCms::Seeds::FieldSet

Inherits:
Object
  • Object
show all
Defined in:
lib/rivet_cms/seeds.rb

Overview

Collects field definitions inside a content_type/component block.

Constant Summary collapse

SCALAR_TYPES =
%i[string text rich_text markdown integer decimal enumeration boolean image video file date datetime].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFieldSet

Returns a new instance of FieldSet.



70
71
72
# File 'lib/rivet_cms/seeds.rb', line 70

def initialize
  @definitions = []
end

Instance Attribute Details

#definitionsObject (readonly)

Returns the value of attribute definitions.



68
69
70
# File 'lib/rivet_cms/seeds.rb', line 68

def definitions
  @definitions
end

Instance Method Details

#component(key, use:, **opts) ⇒ Object



84
85
86
# File 'lib/rivet_cms/seeds.rb', line 84

def component(key, use:, **opts)
  add(:component, key, opts.merge(use: use))
end

#reference(key, to:, **opts) ⇒ Object



80
81
82
# File 'lib/rivet_cms/seeds.rb', line 80

def reference(key, to:, **opts)
  add(:reference, key, opts.merge(to: to))
end