class Hash

Public Instance Methods

default_to!(defaults) click to toggle source
# File lib/spectre/helpers.rb, line 108
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!
defaults_to!(defaults)
Alias for: default_to!
should_contain(other) click to toggle source
# File lib/spectre/assertion.rb, line 60
def should_contain(other)
  raise AssertionFailure.new(other, self) unless self.merge(other) == self
end
should_not_contain(other) click to toggle source
# File lib/spectre/assertion.rb, line 64
def should_not_contain(other)
  raise AssertionFailure.new(other, self) unless self.merge(other) != self
end
symbolize_keys() click to toggle source
# File lib/spectre/helpers.rb, line 104
def symbolize_keys
  self.inject({}) { |memo, (k,v)| memo[k.to_sym] = v; memo }
end