Sha256: ce16e2cc8eb368f1210af45cc9073cf7860a81def1465da98d0584d2c78e8ecc

Contents?: true

Size: 489 Bytes

Versions: 4

Compression:

Stored size: 489 Bytes

Contents

require 'virtus'

require_relative '../repository/interface_repository'
require_relative 'coercions'

module Vedeu
  class InterfaceCollection < Virtus::Attribute
    include Coercions

    def coerce(values)
      return [] if empty?(values)

      if multiple?(values)
        values.map do |value|
          InterfaceRepository.update(value[:name], value)
        end

      elsif single?(values)
        [InterfaceRepository.update(values[:name], values)]

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.29 lib/vedeu/models/interface_collection.rb
vedeu-0.0.28 lib/vedeu/models/interface_collection.rb
vedeu-0.0.27 lib/vedeu/models/interface_collection.rb
vedeu-0.0.26 lib/vedeu/models/interface_collection.rb