Sha256: 696aaef77a24fb61a4965cc5f3ce70c773c667f732f409718289f3d8ceb8ca57

Contents?: true

Size: 701 Bytes

Versions: 28

Compression:

Stored size: 701 Bytes

Contents

module Workarea
  class Release
    class Preview
      attr_reader :release

      def initialize(release)
        @release = release
      end

      def releases
        @releases ||= release.scheduled_before + [release]
      end

      def changesets
        @changesets ||= releases.flat_map(&:changesets)
      end

      def changesets_for(model)
        changesets.select do |changeset|
          # Check this way because loading the releasable will cause `load_release_changes`
          # to run this, resulting in a stack overflow.
          changeset.releasable_type == model.class.name &&
            changeset.releasable_id.to_s == model.id.to_s
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.6 app/models/workarea/release/preview.rb
workarea-core-3.5.5 app/models/workarea/release/preview.rb
workarea-core-3.5.4 app/models/workarea/release/preview.rb
workarea-core-3.5.3 app/models/workarea/release/preview.rb
workarea-core-3.5.2 app/models/workarea/release/preview.rb
workarea-core-3.5.1 app/models/workarea/release/preview.rb
workarea-core-3.5.0 app/models/workarea/release/preview.rb
workarea-core-3.5.0.beta.1 app/models/workarea/release/preview.rb