title: JSON data to instance variable in Ruby
body: <p>This is my ruby code / JSON File. Three functions required, I have implemented the first two but am having trouble with the third one. I have only recently started learning ruby - any simplified explanations/answers are much appreciated</p>
  
  <pre><code>class Company
    attr_accessor :jobs
    jobs = Array.new 
  
    ## TODO: Implement this method to load the given JSON file into Ruby built-in data
    ## structures (hashes and arrays).
    def self.load_json(filepath)
      require 'json'
      file = File.read(filepath)
      data_hash = JSON.parse(file)
    end
  
    ## TODO: This method should update the `jobs` property to an array of instances of
    ## class `Job`
    def initialize(filepath)
      # Load the json file and loop over the jobs to create an array of instance of `Job`
      # Assign the `jobs` instance variable.
      load_json(filepath)
      data_hash.each { |jobs|
      array_of_jobs.insert(jobs['name'])
      }
    end
  
    ## TODO: Impelement this method to return applicants from all jobs with a
    ## tag matching this keyword
    def find_applicants(keyword)
      # Use the `jobs` instance variable.
  
    end
  end
  </code></pre>
  
  <p>Below is the JSON file code I am supposed to retrieve the information from.</p>
  
  <pre><code>{
    "jobs": [
      {
        "id": 1,
        "title": "Software Developer",
        "applicants": [
          {
            "id": 1,
            "name": "Rich Hickey",
            "tags": ["clojure", "java", "immutability", "datomic", "transducers"]
          },
          {
            "id": 2,
            "name": "Guido van Rossum",
            "tags": ["python", "google", "bdfl", "drop-box"]
          }
        ]
      },
      {
        "id": 2,
        "title": "Software Architect",
        "applicants": [
          {
            "id": 42,
            "name": "Rob Pike",
            "tags": ["plan-9", "TUPE", "go", "google", "sawzall"]
          },
          {
            "id": 2,
            "name": "Guido van Rossum",
            "tags": ["python", "google", "bdfl", "drop-box"]
          },
          {
            "id": 1337,
            "name": "Jeffrey Dean",
            "tags": ["spanner", "BigTable", "MapReduce", "deep learning", "massive clusters"]
          }
        ]
      }
    ]
  }
  </code></pre>