Sha256: 01bec37404899b5a0c9f0cf950430185b3b307ea2c998a39759f682df83ff1c9

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

module Redmineup
  module Liquid
    class IssueRelationsDrop < ::Liquid::Drop
      def initialize(relations)
        @relations = relations
      end

      def all
        @all ||= @relations.map { |relation| IssueRelationDrop.new(relation) }
      end

      def visible
        @visible ||= @all.select(&:visible?)
      end

      def each(&block)
        all.each(&block)
      end

      def size
        @relations.size
      end
    end

    class IssueRelationDrop < ::Liquid::Drop
      delegate :relation_type, :delay, to: :@relation

      def initialize(relation)
        @relation = relation
      end

      def issue_from
        @issue_from ||= IssueDrop.new(@relation.issue_from)
      end

      def issue_to
        @issue_to ||= IssueDrop.new(@relation.issue_to)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redmineup-1.0.5 lib/redmineup/liquid/drops/issue_relations_drop.rb
redmineup-1.0.4 lib/redmineup/liquid/drops/issue_relations_drop.rb
redmineup-1.0.3 lib/redmineup/liquid/drops/issue_relations_drop.rb
redmineup-1.0.2 lib/redmineup/liquid/drops/issue_relations_drop.rb