example/yaml_students/yaml_students.rb
# Load data from a yaml file. File name is set at class initialization
# To change the file name, update the file attribute
Load data from a yaml file. File name is set at class initialization
To change the file name, update the file attribute
Load data from a yaml file . File name is set at class initialization To change the file name update the file attribute
def load_data
    return false unless File.exist?(@file)
    @data = YAML.load_file(@file)
    @data = { :students => [] } unless @data
    @data[:students] = [] unless @data.key?(:students)
  end
def load_data return false unless File . exist? ( @file ) @data = YAML . load_file ( @file ) @data = { :students => [ ] } unless @data @data [ :students ] = [ ] unless @data . key? ( :students ) end
Load data from a yaml file.
Load data from a yaml file .