Class: Karafka::Routing::Topics
- Inherits:
- 
      Object
      
        - Object
- Karafka::Routing::Topics
 
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/karafka/routing/topics.rb
Overview
Abstraction layer on top of groups of topics
Direct Known Subclasses
Instance Method Summary collapse
- 
  
    
      #delete_if(&block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Allows us to remove elements from the topics. 
- 
  
    
      #each(&block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Yields each topic. 
- 
  
    
      #find(topic_name)  ⇒ Karafka::Routing::Topic 
    
    
  
  
  
  
  
  
  
  
  
    Finds topic by its name. 
- 
  
    
      #initialize(topics_array)  ⇒ Topics 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Topics. 
Constructor Details
#initialize(topics_array) ⇒ Topics
Returns a new instance of Topics.
| 15 16 17 | # File 'lib/karafka/routing/topics.rb', line 15 def initialize(topics_array) @accumulator = topics_array.dup end | 
Instance Method Details
#delete_if(&block) ⇒ Object
Allows us to remove elements from the topics
Block to decide what to delete
| 30 31 32 | # File 'lib/karafka/routing/topics.rb', line 30 def delete_if(&block) @accumulator.delete_if(&block) end | 
#each(&block) ⇒ Object
Yields each topic
| 22 23 24 | # File 'lib/karafka/routing/topics.rb', line 22 def each(&block) @accumulator.each(&block) end | 
#find(topic_name) ⇒ Karafka::Routing::Topic
Finds topic by its name
| 40 41 42 43 | # File 'lib/karafka/routing/topics.rb', line 40 def find(topic_name) @accumulator.find { |topic| topic.name == topic_name } || raise(Karafka::Errors::TopicNotFoundError, topic_name) end |