Class: BBK::App::DomainsSet
- Inherits:
-
Object
- Object
- BBK::App::DomainsSet
- Defined in:
- lib/bbk/app/domains_set.rb
Instance Method Summary collapse
-
#[](domain_name) ⇒ String
Get exchange name by domain.
- #add(domain) ⇒ Object (also: #<<)
-
#each(&block) ⇒ Object
Each method implementation for object iteration.
-
#has?(domain_name) ⇒ Boolean
Check if store has information about domain.
-
#initialize(*domains) ⇒ DomainsSet
constructor
A new instance of DomainsSet.
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
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
31 32 33 |
# File 'lib/bbk/app/domains_set.rb', line 31 def has?(domain_name) @domains.key? domain_name end |