Class: IdempotentEnumerable::Configurator

Inherits:
Object
  • Object
show all
Defined in:
lib/idempotent_enumerable/configurator.rb

Constant Summary collapse

REDEFINEABLE =
i[map flat_map collect collect_concat].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ Configurator

Returns a new instance of Configurator.



5
6
7
# File 'lib/idempotent_enumerable/configurator.rb', line 5

def initialize(host)
  @host = host
end

Instance Attribute Details

#constructorObject



9
10
11
# File 'lib/idempotent_enumerable/configurator.rb', line 9

def constructor
  @constructor || :new
end

Instance Method Details

#redefine_map!(only: REDEFINEABLE, all: nil) ⇒ Object



15
16
17
18
# File 'lib/idempotent_enumerable/configurator.rb', line 15

def redefine_map!(only: REDEFINEABLE, all: nil)
  (Array(only) & REDEFINEABLE).each { |method| redefine(method, all) }
  self
end