module Eancom class Definition attr_reader :name, :type, :block def self.create(name:, type:, &block) definition = new(name: name, type: type, &block) Eancom.register_definition(definition) end def initialize(name:, type:, &block) @name = name @type = type @block = block end def run(document:, config:) @block.call(document, config) end end end