class TestCentricity::DataPresenter
Attributes
context[RW]
current[RW]
Public Class Methods
current()
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 47 def self.current @current end
current=(current)
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 51 def self.current=(current) @current = current end
new(data)
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 43 def initialize(data) self.attributes = data end
Public Instance Methods
to_hash(node_name = nil)
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 55 def to_hash(node_name = nil) data = {} if node_name.nil? data = { class: self.class.name, attributes: self.attributes } else data[node_name] = { class: self.class.name, attributes: self.attributes } end data end
to_json(node_name = nil)
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 74 def to_json(node_name = nil) data = to_hash(node_name) data.to_json end
to_yaml(node_name = nil)
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 65 def to_yaml(node_name = nil) data = to_hash(node_name) data.to_yaml end
write_json_data(file_name, mode, node_name = nil)
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 79 def write_json_data(file_name, mode, node_name = nil) File.open(file_name, mode) { |file| file.write(to_json(node_name)) } end
write_yaml_data(file_name, mode, node_name = nil)
click to toggle source
# File lib/testcentricity_web/data_objects/data_objects_helper.rb, line 70 def write_yaml_data(file_name, mode, node_name = nil) File.open(file_name, mode) { |file| file.write(to_yaml(node_name)) } end