Class: RivetCms::Seeds::FieldSet
- Inherits:
-
Object
- Object
- RivetCms::Seeds::FieldSet
- 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
-
#definitions ⇒ Object
readonly
Returns the value of attribute definitions.
Instance Method Summary collapse
- #component(key, use:, **opts) ⇒ Object
-
#initialize ⇒ FieldSet
constructor
A new instance of FieldSet.
- #reference(key, to:, **opts) ⇒ Object
Constructor Details
#initialize ⇒ FieldSet
Returns a new instance of FieldSet.
70 71 72 |
# File 'lib/rivet_cms/seeds.rb', line 70 def initialize @definitions = [] end |
Instance Attribute Details
#definitions ⇒ Object (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 |