Sha256: 2480fd568507f249cdbaf88e281b061210fb0c4540b240e93572d5645faec7ae
Contents?: true
Size: 560 Bytes
Versions: 13
Compression:
Stored size: 560 Bytes
Contents
module SoberSwag module Nodes ## # Root node of the tree class Primitive < Base def initialize(value, metadata = {}) @value = value @metadata = metadata end attr_reader :value, :metadata def map(&block) self.class.new(block.call(value)) end def deconstruct [value, metadata] end def deconstruct_keys(_) { value: value, metadata: metadata } end def cata(&block) block.call(self.class.new(value, metadata)) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems