summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/outputs.rb
blob: 23a37f5088c7e1d5e562ceaa4d6fb9bd6fdefec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module Oxidized
  class Model
    class Outputs
      def to_cfg
        type_to_str(nil)
      end

      def type_to_str want_type
        type(want_type).map { |out| out }.join
      end

      def << output
        @outputs << output
      end

      def unshift output
        @outputs.unshift output
      end

      def all
        @outputs
      end

      def type type
        @outputs.select { |out| out.type == type }
      end

      def types
        @outputs.map { |out| out.type }.uniq.compact
      end

      private

      def initialize
        @outputs = []
      end
    end
  end
end