module SwotCollectionMethods

Module for methods that act on the entire Swot dataset.

Public Instance Methods

all_domains() click to toggle source

Returns an array of domain strings.

# File lib/swot/collection_methods.rb, line 6
def all_domains
  each_domain.map(&:to_s)
end
each_domain() { |from_path| ... } click to toggle source

Yields a Swot instance for every domain under lib/domains. Does not

include blacklisted or ACADEMIC_TLDS domains.

returns a Enumerator object with Swot instances if no block is given

# File lib/swot/collection_methods.rb, line 14
def each_domain
  return to_enum(:each_domain) unless block_given?
  Pathname.glob(Pathname.new(Swot.domains_path).join('**/*.txt')) do |path|
    yield(Swot.from_path(path))
  end
end