Sha256: 3a6d37fdd623c24e4e477771d3484a5e8a4a7fcae6e5bba55ecc84cca15131ce

Contents?: true

Size: 823 Bytes

Versions: 6

Compression:

Stored size: 823 Bytes

Contents

module Ecoportal
  module API
    class V2
      class Page
        class Stages < Ecoportal::API::Common::Content::CollectionModel
          class_resolver :stage_class, "Ecoportal::API::V2::Page::Stage"

          self.klass     = :stage_class
          self.order_key = :ordering

          def ooze
            _parent.ooze
          end

          # @param name [String, Regexp] the `name` of the stage to find.
          # @return [Ecoportal::API::V2::Page::Stage, nil]
          def get_by_name(name)
            find do |stage|
              same_string?(stage.name, name)
            end
          end

          def ordered
            sort_by.with_index do |stage, index|
              [stage.ordering, index]
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecoportal-api-v2-2.0.12 lib/ecoportal/api/v2/page/stages.rb
ecoportal-api-v2-2.0.11 lib/ecoportal/api/v2/page/stages.rb
ecoportal-api-v2-2.0.10 lib/ecoportal/api/v2/page/stages.rb
ecoportal-api-v2-2.0.9 lib/ecoportal/api/v2/page/stages.rb
ecoportal-api-v2-2.0.8 lib/ecoportal/api/v2/page/stages.rb
ecoportal-api-v2-2.0.7 lib/ecoportal/api/v2/page/stages.rb