Sha256: 0589dc6c892c018232ac2eed49ff2f40bfce422a5263321a67a234b429277a9b
Contents?: true
Size: 748 Bytes
Versions: 37
Compression:
Stored size: 748 Bytes
Contents
require 'spec_helper' require 'sugar-high/hash' describe "SugarHigh" do describe "Hash packet" do describe '#hash_revert' do it "should revert hash" do {:a => 'hello', :b => 'hi', :c => 'hi'}.hash_revert.should == {'hello' => [:a], 'hi' => [:b, :c]} end it "should try keys in hash until triggered" do {:a => 'hello', :b => 'hi'}.try_keys([:x, :a, :b]).should == 'hello' end it "should return nil if no key triggered" do {:a => 'hello', :b => 'hi'}.try_keys([:x, :y, :z]).should == nil end it "should return nil if no key triggered" do {:a => 'hello', :b => 'hi'}.try_keys([:x, :y, :z], :default => 'none').should == 'none' end end end end
Version data entries
37 entries across 37 versions & 1 rubygems