Sha256: 2a3b73a2d6a928692bb77e15999e41e90296668754e8f7343191cf8307fba80f
Contents?: true
Size: 762 Bytes
Versions: 18
Compression:
Stored size: 762 Bytes
Contents
module SoberSwag module Nodes ## # A List of the contained element types. # # Unlike {SoberSwag::Nodes::Array}, this actually models arrays. # The other one is a node that *is* an array in terms of what it contains. # Kinda confusing, but oh well. class List < Base def initialize(element) @element = element end attr_reader :element def deconstruct [element] end def deconstruct_keys(_) { element: element } end def cata(&block) block.call( self.class.new( element.cata(&block) ) ) end def map(&block) self.class.new( element.map(&block) ) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems