Sha256: 5420dc783b3df64c833abd3674631fc47427eb471563a6e0adceb232cead79aa
Contents?: true
Size: 840 Bytes
Versions: 6
Compression:
Stored size: 840 Bytes
Contents
module Amakanize class AuthorNames include ::Enumerable AUTHOR_NAME_SEPARATORS = %w( , , 、 ) AUTHOR_NAME_SEPARATORS_REGEXP = ::Regexp.union(AUTHOR_NAME_SEPARATORS) # @param raw [String] def initialize(raw) @raw = raw end # @note Implementation for Enumerable def each(&block) author_names.each(&block) end private # @private # @return [Array<Amakanize::AuthorName>] def author_names segments.map do |segment| ::Amakanize::AuthorName.new(segment) end.reject do |author_name| author_name.to_s.empty? end end # @private # @return [String] def raw @raw end # @private # @return [Array<String>] def segments raw.split(AUTHOR_NAME_SEPARATORS_REGEXP) end end end
Version data entries
6 entries across 6 versions & 1 rubygems