Sha256: 7bbf4054276aacae9848b49c000c657b004ebdf08ad32987654ef3d494e92f09

Contents?: true

Size: 642 Bytes

Versions: 7

Compression:

Stored size: 642 Bytes

Contents

module Ecoportal
  module API
    class V2
      class Page
        class Component
          class LawField < Page::Component
            embeds_many :snippets, klass: "Ecoportal::API::V2::Page::Component::Law", order_key: :weight

            def ordered_snippets
              snippets.sort_by.with_index do |snippet, index|
                [snippet.weight, index]
              end
            end

            def to_s(delimiter: "\n")
              ordered_snippets.map(&:to_s).join(delimiter)
            end
          end
        end
      end
    end
  end
end

require 'ecoportal/api/v2/page/component/law'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ecoportal-api-v2-0.9.3 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-0.9.2 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-0.9.1 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-0.8.33 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-0.8.32 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-0.8.31 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-0.8.30 lib/ecoportal/api/v2/page/component/law_field.rb