class Marver::Factory::Character

Public Class Methods

new(results) click to toggle source
# File lib/marver/factories/character.rb, line 7
def initialize(results)
  @results = results
end

Public Instance Methods

build() click to toggle source
# File lib/marver/factories/character.rb, line 11
def build
  if @results.kind_of?(Array)
    @results.collect do |character|
      create_character(character)
    end
  else
    create_character(@results)
  end
end

Private Instance Methods

create_character(params) click to toggle source
# File lib/marver/factories/character.rb, line 22
def create_character(params)
  attributes = Marver::CharacterAttributesMapper.new(params).map
  Marver::Character.new(attributes: attributes)
end