class OpenStruct
Public Instance Methods
default_to!(defaults)
click to toggle source
# File lib/spectre/helpers.rb, line 91 def default_to! defaults defaults.each_key do |key| if not self[key] != nil self[key] = defaults[key] end end end
Also aliased as: defaults_to!
pick(path)
click to toggle source
# File lib/spectre/helpers.rb, line 85 def pick path raise ArgumentError.new("`path' must not be nil or empty") if path.nil? or path.empty? JsonPath.on(self, path) end
to_json(*args, **kwargs)
click to toggle source
# File lib/spectre/helpers.rb, line 81 def to_json *args, **kwargs self.to_h.inject({}) { |memo, (k,v)| memo[k] = v.is_a?(OpenStruct) ? v.to_h : v; memo }.to_json(*args, **kwargs) end