Class: JsonMoviesParser

Inherits:
Object
  • Object
show all
Defined in:
lib/filmaffinity/json_movies_parser.rb

Instance Method Summary collapse

Instance Method Details

#to_hashes(movies) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/filmaffinity/json_movies_parser.rb', line 4

def to_hashes(movies)
  movies.map do |movie|
    {
      'id' => movie.id,
      'title' => movie.title
    }
  end
end

#to_json(movies) ⇒ Object



13
14
15
# File 'lib/filmaffinity/json_movies_parser.rb', line 13

def to_json(movies)
  to_hashes(movies).to_json
end