Sha256: beab32b19ce3bf841fc7270e48450f60e20c5376a527082feb7b4fa4ba56d6d2

Contents?: true

Size: 1.23 KB

Versions: 34

Compression:

Stored size: 1.23 KB

Contents

module Metanorma
  module Standoc
    module Blocks
      def reqt_subpart?(name)
        @reqt_model&.reqt_subpart?(name)
      end

      def requirement_subpart(node)
        @reqt_model.requirement_subpart(node, keep_attrs(node))
      end

      def default_requirement_model
        :default
      end

      def select_requirement_model(node)
        return if @reqt_model

        @reqt_model_name = node.attr("model") || @default_requirement_model
        @reqt_model = @reqt_models.model(@reqt_model_name)
      end

      def requirement(node, obligation, type)
        nested = @reqt_model
        !node.attr("type") &&
          !%w(requirement recommendation permission).include?(type) and
          node.set_attr("type", type)
        attrs = keep_attrs(node).merge(id_unnum_attrs(node))
          .merge(model: @reqt_model_name)
        ret = @reqt_model.requirement(node, obligation, attrs)
        @reqt_model = nil unless nested
        ret
      end

      def requirement_validate(docxml)
        docxml.xpath("//requirement | //recommendation | //permission")
          .each_with_object([]) do |r, m|
          ret = @reqt_models.model(r["model"]).validate(r, @log)
          ret.each { |x| m << x }
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
metanorma-standoc-2.7.3 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.7.2 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.7.1 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.7.0 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.6.3 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.6.2 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.6.1 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.6.0 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.5.5 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.5.4 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.5.3 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.5.2 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.5.1 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.5.0 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.4.9 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.4.8 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.4.7 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.4.6 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.4.5 lib/metanorma/standoc/reqt.rb
metanorma-standoc-2.4.4 lib/metanorma/standoc/reqt.rb