Sha256: 15ed57198eb2f4e70d1c7a070f95edf5a0e565362be71f273384e23bdd1d99dc

Contents?: true

Size: 352 Bytes

Versions: 5

Compression:

Stored size: 352 Bytes

Contents

require 'virtus'

require 'vedeu/support/interface_store'

# Todo: mutation (persistence)

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.1.7 lib/vedeu/models/attributes/interface_collection.rb
vedeu-0.1.6 lib/vedeu/models/attributes/interface_collection.rb
vedeu-0.1.5 lib/vedeu/models/attributes/interface_collection.rb
vedeu-0.1.4 lib/vedeu/models/attributes/interface_collection.rb
vedeu-0.1.3 lib/vedeu/models/attributes/interface_collection.rb