Class: Eskimo::Components::Either
- Inherits:
- 
      Object
      
        - Object
- Eskimo::Components::Either
 
- Defined in:
- lib/eskimo/components/either.rb
Overview
Instance Attribute Summary collapse
- 
  
    
      #children  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute children. 
Instance Method Summary collapse
- 
  
    
      #initialize(primary, fallback)  ⇒ Either 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Either. 
- #render(render:) ⇒ Object
Constructor Details
#initialize(primary, fallback) ⇒ Either
Returns a new instance of Either
| 17 18 19 | # File 'lib/eskimo/components/either.rb', line 17 def initialize(primary, fallback) @children = [ primary, fallback ] end | 
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children
| 15 16 17 | # File 'lib/eskimo/components/either.rb', line 15 def children @children end | 
Instance Method Details
#render(render:) ⇒ Object
| 21 22 23 24 25 26 27 | # File 'lib/eskimo/components/either.rb', line 21 def render(render:, **) for child in children do rendered = render[child] return rendered unless rendered.empty? end end |