Sha256: 87cd7dd825c4100de81c1e71ba467e5774568dccaa5c302def450171cede202a

Contents?: true

Size: 424 Bytes

Versions: 7

Compression:

Stored size: 424 Bytes

Contents

class Hash

  unless instance_methods.include? :only
    # same as select_with_keys without forcing `Symbol` usage
    #
    def only *ks
      ks = ks.compact.uniq
      select {|k,v| ks.include? k}
    end
  end

  unless instance_methods.include? :not
    # same as select_without_keys without forcing `Symbol` usage
    #
    def not *ks
      ks = ks.compact.uniq
      select {|k,v| !ks.include? k}
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
terraformer-0.0.9 lib/ext/hash.rb
terraformer-0.0.8 lib/ext/hash.rb
terraformer-0.0.7 lib/ext/hash.rb
terraformer-0.0.6 lib/ext/hash.rb
terraformer-0.0.4 lib/ext/hash.rb
terraformer-0.0.3 lib/ext/hash.rb
terraformer-0.0.2 lib/ext/hash.rb