Sha256: 9de1876ddd31e9f898fd638525b105d0e2ceddc865ece1066aaebba1d7628ec3

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

module Glman
  module Commands
    module Configs
      class UsersConfig
        class UsersConfigurationError < StandardError; end

        include InitRequired

        attr_required :config_manager

        DEFAULT = {}

        def set(users={})
          raise UsersConfigurationError.new('incorrect data') unless users.kind_of? Hash
          hash = nil if users.empty?
          config_manager.set(users: users)
        end

        def get
          config_manager.get[:users] || DEFAULT
        end

        def clear
          set(DEFAULT)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glman-0.1.3 lib/glman/commands/configs/users_config.rb
glman-0.1.2 lib/glman/commands/configs/users_config.rb