class Amakanize::AuthorNames

Constants

AUTHOR_NAME_SEPARATORS
AUTHOR_NAME_SEPARATORS_REGEXP

Public Class Methods

new(raw) click to toggle source

@param raw [String]

# File lib/amakanize/author_names.rb, line 14
def initialize(raw)
  @raw = raw
end

Public Instance Methods

each(&block) click to toggle source

@note Implementation for Enumerable

# File lib/amakanize/author_names.rb, line 19
def each(&block)
  author_names.each(&block)
end

Private Instance Methods

author_names() click to toggle source

@private @return [Array<Amakanize::AuthorName>]

# File lib/amakanize/author_names.rb, line 27
def author_names
  segments.map do |segment|
    ::Amakanize::AuthorName.new(segment)
  end.reject do |author_name|
    author_name.to_s.empty?
  end
end
raw() click to toggle source

@private @return [String]

# File lib/amakanize/author_names.rb, line 37
def raw
  @raw
end
segments() click to toggle source

@private @return [Array<String>]

# File lib/amakanize/author_names.rb, line 43
def segments
  raw.split(AUTHOR_NAME_SEPARATORS_REGEXP)
end