Class: BBK::App::DomainsSet

Inherits:
Object
  • Object
show all
Defined in:
lib/bbk/app/domains_set.rb

Instance Method Summary collapse

Constructor Details

#initialize(*domains) ⇒ DomainsSet

Returns a new instance of DomainsSet.



6
7
8
# File 'lib/bbk/app/domains_set.rb', line 6

def initialize(*domains)
  @domains = domains.map{|d| [d.name.to_s, d] }.to_h
end

Instance Method Details

#[](domain_name) ⇒ String

Get exchange name by domain

Parameters:

  • domain_name (String)

    domain name

Returns:

  • (String)

    exchange name configured for passed domain name



13
14
15
# File 'lib/bbk/app/domains_set.rb', line 13

def [](domain_name)
  @domains[domain_name]
end

#add(domain) ⇒ Object Also known as: <<



17
18
19
# File 'lib/bbk/app/domains_set.rb', line 17

def add(domain)
  @domains[domain.name.to_s] = domain
end

#each(&block) ⇒ Object

Each method implementation for object iteration



24
25
26
# File 'lib/bbk/app/domains_set.rb', line 24

def each(&block)
  @domains.values.each(&block)
end

#has?(domain_name) ⇒ Boolean

Check if store has information about domain

Parameters:

  • domain_name (String)

    domain name

Returns:

  • (Boolean)

    has information about domain



31
32
33
# File 'lib/bbk/app/domains_set.rb', line 31

def has?(domain_name)
  @domains.key? domain_name
end