Class: Dhall::AsDhall::ExpressionList::Optional
- Inherits:
-
Object
- Object
- Dhall::AsDhall::ExpressionList::Optional
- Defined in:
- lib/dhall/as_dhall.rb
Instance Method Summary collapse
-
#initialize(_, exprs, types) ⇒ Optional
constructor
A new instance of Optional.
- #list ⇒ Object
Constructor Details
#initialize(_, exprs, types) ⇒ Optional
Returns a new instance of Optional.
170 171 172 173 |
# File 'lib/dhall/as_dhall.rb', line 170 def initialize(_, exprs, types) @type = types.compact.first @exprs = exprs end |
Instance Method Details
#list ⇒ Object
175 176 177 178 179 180 181 182 183 |
# File 'lib/dhall/as_dhall.rb', line 175 def list List.new(elements: @exprs.map do |x| if x.nil? Dhall::OptionalNone.new(value_type: @type) else Dhall::Optional.new(value: x) end end) end |