Sha256: 0551eb628674a25f5988fa493a77f850c94226ac05829b85ec987dc35d18c0ef

Contents?: true

Size: 875 Bytes

Versions: 9

Compression:

Stored size: 875 Bytes

Contents

require 'bbk/app/domains/by_block'

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

      # Get exchange name by domain
      # @param domain_name [String] domain name
      # @return [String] exchange name configured for passed domain name
      def [](domain_name)
        @domains[domain_name]
      end

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

      alias << add

      # Each method implementation for object iteration
      def each(&block)
        @domains.values.each(&block)
      end

      # Check if store has information about domain
      # @param domain_name [String] domain name
      # @return [Boolean] has information about domain
      def has?(domain_name)
        @domains.key? domain_name
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bbk-app-1.1.1.273627 lib/bbk/app/domains_set.rb
bbk-app-1.1.1.273338 lib/bbk/app/domains_set.rb
bbk-app-1.1.1.273312 lib/bbk/app/domains_set.rb
bbk-app-1.1.1.273294 lib/bbk/app/domains_set.rb
bbk-app-1.1.0.219406 lib/bbk/app/domains_set.rb
bbk-app-1.1.0.216998 lib/bbk/app/domains_set.rb
bbk-app-1.1.0.204569 lib/bbk/app/domains_set.rb
bbk-app-1.1.0.200751 lib/bbk/app/domains_set.rb
bbk-app-1.1.0.200186 lib/bbk/app/domains_set.rb