<commit_before>module Imba
  class Movie
    def self.all
      Imba::DataStore[:movies] || []
    end
  end
end<commit_msg>implement movie class but can not modify frozen class<commit_after>module Imba
  class Movie
    attr_reader :id
    attr_accessor :data

    def initialize(id)
      @id = id
      @data = Imba::DataStore.data_store
    end

    def save
      Imba::DataStore[id] = { id: id, title: title, year: year, genres: genres, rating: rating }
    end

    def self.all
      []
    end

    def id
      Imba::DataStore[id][:id]
    end

    def title
      Imba::DataStore[id][:title]
    end

    def title=(value)
      update(:title, value)
    end

    def year
      Imba::DataStore[id][:year]
    end

    def year=(value)
      update(:year, value)
    end

    def genres
      Imba::DataStore[id][:genres]
    end

    def genres=(values)
      update(:genres, values.map { |g| g.downcase.to_sym })
    end

    def rating
      Imba::DataStore[id][:rating]
    end

    def rating=(value)
      update(:rating, value)
    end

    def update(key, value)
      Imba::DataStore[id] = Imba::DataStore[id].merge(key => value)
    end
  end
end
{'fraction_non_alphanumeric': 0.11396743787489289, 'fraction_numerical': 0.0, 'mean_word_length': 2.337142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2529861', 'n_tokens_mistral': 421, 'n_tokens_neox': 404, 'n_words': 100}