Skip to content
Permalink
Browse files

Use Ruby's own forwardable again

A few things seem to be slower again. Investigate!
  • Loading branch information...
gonzedge committed May 7, 2017
1 parent 4bed09b commit b98b0bf103cf113ad137ab7e27af90e8cadf6668
@@ -2,6 +2,7 @@

## 1.0.1 (unreleased) [compare][compare_v1_0_0_and_master]

- Use Ruby's own `Forwardable` again by [@gonzedge][github_user_gonzedge]
- Remove CodeClimate test reporter by [@gonzedge][github_user_gonzedge]
- Add Ruby 2.4.1 to supported versions by [@gonzedge][github_user_gonzedge]

@@ -13,7 +13,7 @@ module Rambling
# Entry point for rambling-trie API.
module Trie
class << self
extend Rambling::Trie::Forwardable
extend ::Forwardable

delegate [
:readers,
@@ -3,7 +3,7 @@ module Trie
module Configuration
# Collection of configurable providers.
class ProviderCollection
extend Rambling::Trie::Forwardable
extend ::Forwardable

# The name of this provider collection.
# @return [String] the name of this provider collection.
@@ -2,7 +2,7 @@ module Rambling
module Trie
# Wrapper on top of trie data structure.
class Container
extend Rambling::Trie::Forwardable
extend ::Forwardable
include ::Enumerable

delegate [
@@ -1,21 +1,21 @@
module Rambling
module Trie
# Provides delegation behavior.
module Forwardable
# Custom delegation behavior due to Ruby 2.4 delegation performance
# degradation. See {https://bugs.ruby-lang.org/issues/13111 Bug #13111}.
# @param [Hash] methods_to_target a Hash consisting of the methods to be
# delegated and the target to delegate those methods to.
# @return [Hash] the `methods_to_target` parameter.
def delegate methods_to_target
methods_to_target.each do |methods, target|
methods.each do |method|
define_method method do |*args|
send(target).send method, *args
end
end
end
end
end
end
end
# module Rambling
# module Trie
# # Provides delegation behavior.
# module Forwardable
# # Custom delegation behavior due to Ruby 2.4 delegation performance
# # degradation. See {https://bugs.ruby-lang.org/issues/13111 Bug #13111}.
# # @param [Hash] methods_to_target a Hash consisting of the methods to be
# # delegated and the target to delegate those methods to.
# # @return [Hash] the `methods_to_target` parameter.
# def delegate methods_to_target
# methods_to_target.each do |methods, target|
# methods.each do |method|
# define_method method do |*args|
# send(target).send method, *args
# end
# end
# end
# end
# end
# end
# end
@@ -2,7 +2,7 @@ module Rambling
module Trie
# A representation of a node in the trie data structure.
class Node
extend Rambling::Trie::Forwardable
extend ::Forwardable
include Rambling::Trie::Compressable
include Rambling::Trie::Enumerable
include Rambling::Trie::Comparable
@@ -4,7 +4,7 @@ module Serializers
# Zip file serializer. Dumps/loads contents from zip files. Automatically
# detects if zip file contains `.marshal` or `.yml` file
class Zip
extend Rambling::Trie::Forwardable
extend ::Forwardable

# Creates a new Zip serializer.
# @param [Properties] properties the configuration properties set up so

0 comments on commit b98b0bf

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.