class Transpec::DynamicAnalyzer::RuntimeData
Attributes
data[R]
Public Class Methods
load(string_or_io)
click to toggle source
# File lib/transpec/dynamic_analyzer/runtime_data.rb, line 15 def self.load(string_or_io) data = JSON.load(string_or_io, nil, object_class: CompatibleOpenStruct) new(data) end
new(data = CompatibleOpenStruct.new)
click to toggle source
# File lib/transpec/dynamic_analyzer/runtime_data.rb, line 20 def initialize(data = CompatibleOpenStruct.new) error_message = data[RUNTIME_DATA_ERROR_MESSAGE_KEY] fail AnalysisError, error_message if error_message @data = data end
Public Instance Methods
[](node, key = nil)
click to toggle source
# File lib/transpec/dynamic_analyzer/runtime_data.rb, line 27 def [](node, key = nil) node_data = data[node_id(node)] return nil unless node_data return node_data unless key node_data[key] end
present?(node, key)
click to toggle source
# File lib/transpec/dynamic_analyzer/runtime_data.rb, line 38 def present?(node, key) node_data = self[node] return false unless node_data node_data.respond_to?(key) end
run?(node)
click to toggle source
# File lib/transpec/dynamic_analyzer/runtime_data.rb, line 34 def run?(node) !self[node].nil? end