Sha256: 3556f03786da5347102d039e8a9c401ee62eccabbb89771602c23db2408b50b0
Contents?: true
Size: 951 Bytes
Versions: 5
Compression:
Stored size: 951 Bytes
Contents
module Insulin # Author:: Sam (mailto:sam@cruft.co) # License:: MIT # This class represents a set of notes class OnTrackNoteSet < Hash # Parse the string 's' def initialize s # Notes separated by newlines l = s.split"\n" # For each line l.each do |n| # Make a note x = OnTrackNote.new n # This field will only exists for notes of a valid type if x.type # If we don't yet have this key if not self[x.type] # If the content is a list if x.content.class.name == "Array" # This becomes our value self[x.type] = x.content else # Otherwise make it onto a list self[x.type] = [x.content] end else # This key exists, so we append this value self[x.type] << x.content end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems