Sha256: 70abdd4beacfd6435a653f69a6c291f5d8a978736bc360e8c72803aabfb807f7
Contents?: true
Size: 474 Bytes
Versions: 4
Compression:
Stored size: 474 Bytes
Contents
require 'virtus' require_relative 'line' require_relative 'coercions' module Vedeu class InvalidLine < StandardError; end class LineCollection < Virtus::Attribute include Coercions def coerce(values) return [] if empty?(values) if multiple?(values) values.map { |v| Line.new(v) } elsif single?(values) [Line.new(values)] elsif just_text?(values) [Line.new({ streams: values })] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems