Class: Textus::Action::RuleList

Inherits:
Base
  • Object
show all
Extended by:
Contract::DSL
Defined in:
lib/textus/action/rule_list.rb

Constant Summary collapse

BURN =
:sync
LIST_FIELDS =
Textus::Manifest::Schema::FIELD_REGISTRY.select { |_, m| m[:in_rule_list] }.keys.freeze

Instance Method Summary collapse

Methods included from Contract::DSL

arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view

Methods inherited from Base

#args, inherited

Instance Method Details

#call(container:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/textus/action/rule_list.rb', line 16

def call(container:, **)
  manifest = container.manifest
  manifest.rules.blocks.map do |block|
    row = { "match" => block.match }
    self.class::LIST_FIELDS.each do |field|
      value = block.public_send(field)
      row[field.to_s] = serialize(field, value) unless value.nil?
    end
    row
  end
end