Sha256: c375059dd71ef5d8a9c7b8dd56c6f1bff95237ccd97a7ab6da0f8fa816470452

Contents?: true

Size: 728 Bytes

Versions: 26

Compression:

Stored size: 728 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 empty?
              snippets.empty?
            end
            
            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

26 entries across 26 versions & 1 rubygems

Version Path
ecoportal-api-v2-2.0.12 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.11 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.10 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.9 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.8 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.7 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.6 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.5 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.4 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.3 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.2 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.1 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-2.0.0 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-1.1.8 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-1.1.7 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-1.1.6 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-1.1.5 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-1.1.4 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-1.1.3 lib/ecoportal/api/v2/page/component/law_field.rb
ecoportal-api-v2-1.1.2 lib/ecoportal/api/v2/page/component/law_field.rb