Class: ActiveMocker::HashProcess Private

Inherits:
Object
  • Object
show all
Defined in:
lib/active_mocker/mock/hash_process.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash, processor) ⇒ HashProcess

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of HashProcess.

API:

  • private



7
8
9
10
11
# File 'lib/active_mocker/mock/hash_process.rb', line 7

def initialize(hash, processor)
  @hash         = hash
  @processor    = processor
  @hash_process = {}
end

Instance Attribute Details

#hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



5
6
7
# File 'lib/active_mocker/mock/hash_process.rb', line 5

def hash
  @hash
end

#processorObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



5
6
7
# File 'lib/active_mocker/mock/hash_process.rb', line 5

def processor
  @processor
end

Instance Method Details

#[](val) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



13
14
15
# File 'lib/active_mocker/mock/hash_process.rb', line 13

def [](val)
  @hash_process[val] ||= processor.call(hash[val])
end

#merge(merge_hash) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



17
18
19
20
# File 'lib/active_mocker/mock/hash_process.rb', line 17

def merge(merge_hash)
  self.hash = hash.merge(merge_hash.hash)
  self
end