Sha256: 4eb7a5e9442be41929ebbb4fe16c504f4b3c3b2566c47546c57a564766742ced

Contents?: true

Size: 339 Bytes

Versions: 4

Compression:

Stored size: 339 Bytes

Contents

require 'virtus'

require_relative '../repository/interface_repository'

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

      [values].flatten.map do |value|
        InterfaceRepository.update(value.fetch(:name, nil), value)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.33 lib/vedeu/models/interface_collection.rb
vedeu-0.0.32 lib/vedeu/models/interface_collection.rb
vedeu-0.0.31 lib/vedeu/models/interface_collection.rb
vedeu-0.0.30 lib/vedeu/models/interface_collection.rb