Class: Eskimo::ASCII::Either
- Inherits:
-
Object
- Object
- Eskimo::ASCII::Either
- Defined in:
- gems/eskimo-ascii/lib/eskimo/ascii/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
16 17 18 |
# File 'gems/eskimo-ascii/lib/eskimo/ascii/components/either.rb', line 16 def initialize(primary, fallback) @children = [ primary, fallback ] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children
14 15 16 |
# File 'gems/eskimo-ascii/lib/eskimo/ascii/components/either.rb', line 14 def children @children end |
Instance Method Details
#render(render:) ⇒ Object
20 21 22 23 24 25 26 |
# File 'gems/eskimo-ascii/lib/eskimo/ascii/components/either.rb', line 20 def render(render:, **) for child in children do rendered = render[child] return rendered unless rendered.empty? end end |