Sha256: 685db22e54cedd303837399e5e2fbe33c2c7f491406898ac11f7658b73f5f986
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module VCardio module Parser # # @private # class ParamParser def self.call(part) values = [] name_end_index = part.index(';') if name_end_index params = part[name_end_index + 1, part.length].split(';', -1) values = compose_values(params) end values end # # Join param name/value pair into an array. Strip out DQUOTE. Split param # value if comma separated. # def self.compose_param(name, value) value = value.gsub(/"/, '') value = value.split(',') if value.index(',') VCardio::Parameter.new(name, value) end private_class_method :compose_param # # Join all param name/value pairs into a multi-dimensional array. # def self.compose_values(params) values = [] params.each do |param| parts = param.split('=', 2) VCardio::Validator::ParamNameValidator.call(parts[0]) values << compose_param(parts[0], parts[1]) end values end private_class_method :compose_values end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vcardio-0.1.1 | lib/vcardio/parser/param_parser.rb |
vcardio-0.1.0 | lib/vcardio/parser/param_parser.rb |