Module: RedBlackTree::DataDelegation

Included in:
Node
Defined in:
lib/red_black_tree/node/data_delegation.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/red_black_tree/node/data_delegation.rb', line 5

def method_missing method_name, *args, &block
  if @data.respond_to? method_name
    @data.public_send method_name, *args, &block
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/red_black_tree/node/data_delegation.rb', line 13

def respond_to_missing? method_name, include_private = false
  (@data.respond_to? method_name, include_private) || super
end