Class: Gitlab::Fp::Message
- Inherits:
- 
      Object
      
        - Object
- Gitlab::Fp::Message
 
- Defined in:
- lib/gitlab/fp/message.rb
Overview
A message’s content can be a hash containing any object that is relevant to the message. It will be used to provide content when the final Result from the chain is pattern matched on the message type and returned to the user. The content is required to be a hash so that it can be destructured and type-checked with rightward assignment.
Instance Attribute Summary collapse
- 
  
    
      #content  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute content. 
Instance Method Summary collapse
- #==(other) ⇒ TrueClass, FalseClass
- 
  
    
      #initialize(content = {})  ⇒ Message 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    raise [ArgumentError] if content is not a Hash. 
- #to_s ⇒ String
Constructor Details
#initialize(content = {}) ⇒ Message
raise [ArgumentError] if content is not a Hash
| 16 17 18 19 20 | # File 'lib/gitlab/fp/message.rb', line 16 def initialize(content = {}) raise ArgumentError, 'content must be a Hash' unless content.is_a?(Hash) @content = content end | 
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
| 11 12 13 | # File 'lib/gitlab/fp/message.rb', line 11 def content @content end | 
Instance Method Details
#==(other) ⇒ TrueClass, FalseClass
| 24 25 26 | # File 'lib/gitlab/fp/message.rb', line 24 def ==(other) self.class == other.class && content == other.content end | 
#to_s ⇒ String
| 29 30 31 | # File 'lib/gitlab/fp/message.rb', line 29 def to_s inspect end |