Sha256: dddd842b0e191ea4887c0c9b20fd41fefd7cdd7fe609056c62421fb99f7ab347
Contents?: true
Size: 582 Bytes
Versions: 91
Compression:
Stored size: 582 Bytes
Contents
module Mandy class ArraySerializer SEPERATOR = '|' unless defined?(SEPERATOR) attr_reader :items def initialize(items) @items = items || [] end def to_s @items.join(SEPERATOR) end def ==(other) (self.class == other.class && self.items == other.items) || (other.is_a?(Array) && self.items == other) end def to_a @items end def self.from_s(str) str.split(SEPERATOR) end def self.tuples_from_s(str) from_s(str).map {|s| Tuple.from_s(s) } end end end
Version data entries
91 entries across 91 versions & 2 rubygems