Sha256: a2b65b4dc9bfb1d232e46c2655f9d37315220f60efb741ff5cf1086dbbdeb170

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

module MovieStone
  class Retriever
    attr_reader :movie, :rendered

    def initialize(options)
      @options = options
    end

    def retrieve
      response = Providers::Imdb.fetch(@options)
      @movie = MovieStone::Movie.new(
        response.extract!(*MovieStone::Movie.translations.map(&:to_s))
      )
      @rendered = render(@movie)
      @movie
    end

    def render(movie)
      MovieStone::Renderer.new(:simple).render(movie)
    end

    def publish_to(output)
      klazz  = "::MovieStone::Output::#{output.to_s.classify}".safe_constantize
      if klazz
        klazz.send(:new, movie, rendered).output
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
movie_stone-0.1.0 lib/movie_stone/retriever.rb