Sha256: 983c47ceacb4e3cf5e6d90924a8a3328385f3993fc10018c05fbdc2d5e450309

Contents?: true

Size: 458 Bytes

Versions: 3

Compression:

Stored size: 458 Bytes

Contents

require 'singleton'

class AccountRepo

  include Singleton

  def initialize
    @accounts = {}
  end

  def find_by(name)
    @accounts[name] ? @accounts[name] : @accounts.invert[name]
  end

  def find_invert_by(name)
    @accounts.invert[name]
  end

  def regist(login:, slack_name:)
    @accounts[login] = slack_name
  end

  def list
    @accounts
  end

  def delete(name)
    @accounts.delete(name)
  end

  def clear
    @accounts.clear
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lita-teamwork-0.4.1 lib/lita/domain/account_repo.rb
lita-teamwork-0.3.1 lib/lita/domain/account_repo.rb
lita-teamwork-0.2.1 lib/lita/domain/account_repo.rb