module TicTacToeRZ::Languages::YAMLReader
Public Class Methods
read_data(file_path, property)
click to toggle source
# File lib/tic_tac_toe_rz/tictactoeruby.core/languages/yaml_reader.rb, line 8 def self.read_data(file_path, property) raise Exceptions::NilReferenceError, "file_path" if file_path.nil? raise Exceptions::InvalidValueError, "file_path" if file_path == "" file_path = File.dirname(__FILE__) + '/' + file_path raise Exceptions::InvalidValueError, "file_path = #{file_path}" if !(File.exist?(file_path)) raise Exceptions::NilReferenceError, "property" if property.nil? raise Exceptions::InvalidValueError, "property" if property == "" yaml_file = YAML.load_file(file_path) data = yaml_file[property] raise Exceptions::InvalidValueError, property.to_s if data.nil? yaml_content = data end