Sha256: defd6e7a81dc8b9b7013f5d09287879fc2cedc8017c4ef6b65c45de198a33e66

Contents?: true

Size: 346 Bytes

Versions: 2

Compression:

Stored size: 346 Bytes

Contents

require 'virtus'

require_relative 'stream'

module Vedeu
  class StreamCollection < Virtus::Attribute
    def coerce(values)
      return [] if values.nil? || values.empty?

      if values.is_a?(::String)
        [Stream.new({ text: values })]

      else
        [values].flatten.map { |value| Stream.new(value) }

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.0.31 lib/vedeu/models/stream_collection.rb
vedeu-0.0.30 lib/vedeu/models/stream_collection.rb