class HashMap::AfterEachContext

Attributes

original[R]
struct[R]
value[R]

Public Class Methods

new(original, struct, value) click to toggle source
# File lib/hash_map/after_each_context.rb, line 4
def initialize(original, struct, value)
  @original = original
  @struct = struct
  @value = value
end

Public Instance Methods

block?() click to toggle source
# File lib/hash_map/after_each_context.rb, line 14
def block?
  !!struct[:proc]
end
has_key?() click to toggle source
# File lib/hash_map/after_each_context.rb, line 18
def has_key?
  return true if block?
  found = true
  struct[:from].reduce(original) do |prv, nxt|
    unless prv.respond_to?(:key?) && prv.key?(nxt)
      found = false
      break
    end
    prv.send(:[], nxt)
  end
  found
end
provided?() click to toggle source
# File lib/hash_map/after_each_context.rb, line 10
def provided?
  has_key?
end