Class: TestCentricity::DataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/testcentricity_web/data_objects/data_objects_helper.rb

Overview

:nocov:

Direct Known Subclasses

EnvironData

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#file_pathObject

Returns the value of attribute file_path.



58
59
60
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 58

def file_path
  @file_path
end

#nodeObject

Returns the value of attribute node.



59
60
61
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 59

def node
  @node
end

Instance Method Details

#read_json_node_data(file_name, node_name) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 68

def read_json_node_data(file_name, node_name)
  @file_path = "#{PRIMARY_DATA_PATH}#{file_name}"
  @node = node_name
  raw_data = File.read(@file_path)
  data = JSON.parse(raw_data)
  data[node_name]
end

#read_yaml_node_data(file_name, node_name) ⇒ Object



61
62
63
64
65
66
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 61

def read_yaml_node_data(file_name, node_name)
  @file_path = "#{PRIMARY_DATA_PATH}#{file_name}"
  @node = node_name
  data = YAML.load_file(@file_path)
  data[node_name]
end