Class: Hash
- Defined in:
- lib/ruuuby/class/enumerable/hsh.rb
Overview
Ruuuby modifications to existing Class<code>Hash</code>
Instance Method Summary collapse
- #λ𝑓∀🔑:₍🔑∉₎(*keys) ⇒ Object
- #λ𝑓∀🔑:₍🔑∉₎!(*keys) ⇒ Object
-
#∀🔑∃_value?(keys_to_find, expected_value) ⇒ Boolean
TODO: MISSING TDD!.
- #∄🔑?(*keys) ⇒ Boolean
Methods included from Ruuuby::Attribute::Includable::Notation::SetMathematics
Instance Method Details
#λ𝑓∀🔑:₍🔑∉₎(*keys) ⇒ Object
23 |
# File 'lib/ruuuby/class/enumerable/hsh.rb', line 23 def λ𝑓∀🔑:₍🔑∉₎(*keys); self.dup.λ𝑓∀🔑:₍🔑∉₎!(*keys); end |
#λ𝑓∀🔑:₍🔑∉₎!(*keys) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ruuuby/class/enumerable/hsh.rb', line 26 def λ𝑓∀🔑:₍🔑∉₎!(*keys) 🛑 ::ArgumentError.new("| c{Hash}-> m{λ𝑓∀🔑:₍🔑∉₎!} received no args or args of len-zero |") if keys.∅? 🛑 ::RuntimeError.new("| c{Hash}-> m{λ𝑓∀🔑:₍🔑∉₎!} received valid args{#{keys.to_s}} but self is empty |") if self.∅? keys.∀{|key| self.delete(key)} self end |
#∀🔑∃_value?(keys_to_find, expected_value) ⇒ Boolean
TODO: MISSING TDD!
‘does each provided key exist w/ the the same provided value?`
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ruuuby/class/enumerable/hsh.rb', line 41 def ∀🔑∃_value?(keys_to_find, expected_value) matched_keys = 0 num_to_find = keys_to_find.length keys_to_find.∀ do |key| if self.∃🔑?(key) if self[key] == expected_value if matched_keys + 1 == num_to_find return true else matched_keys += 1 end end else return false end end if matched_keys == num_to_find true else 🛑 ::RuntimeError.new("| {Hash}-> m{∀🔑∃_value?} called w/ keys_to_find as{#{keys_to_find.to_s}} and expected_value as {#{expected_value.to_s}} which did not match the result length of{#{matched_keys.to_s}} |") end end |
#∄🔑?(*keys) ⇒ Boolean
20 |
# File 'lib/ruuuby/class/enumerable/hsh.rb', line 20 def ∄🔑?(*keys); !self.key?(*keys); end |