Sha256: f9ff1d46cd9726e89861feeaa283e63403bbd72389641fcdae23cd4605938872

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

module Vedeu
  class InterfaceRepository
    extend Repository

    class << self
      def activate(name)
        deactivate

        all.map do |interface|
          interface.active = true if interface.name == name
        end
      end

      def deactivate
        all.map { |interface| interface.active = false }
      end

      def activated
        query(klass, :active, true)
      end

      def find_by_name(value)
        interface = query(klass, :name, value)

        raise UndefinedInterface if interface.nil?

        interface
      end

      def initial_state
        all.map { |interface| interface.initial_state }
      end

      def klass
        Interface
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.16 lib/vedeu/repository/interface_repository.rb