Class: BothIsGood::DualImplementer

Inherits:
Object
  • Object
show all
Includes:
Memoization
Defined in:
lib/both_is_good.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Memoization

included

Constructor Details

#initialize(*positional, target:, original:, replacement:, **opts) ⇒ DualImplementer

Returns a new instance of DualImplementer.



43
44
45
46
47
48
49
50
51
# File 'lib/both_is_good.rb', line 43

def initialize(*positional, target:, original:, replacement:, **opts)
  @target = target
  @positional = positional
  @kw_original = original
  @kw_replacement = replacement
  @opts = opts

  validate!
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



53
54
55
# File 'lib/both_is_good.rb', line 53

def opts
  @opts
end

#positionalObject (readonly)

Returns the value of attribute positional.



53
54
55
# File 'lib/both_is_good.rb', line 53

def positional
  @positional
end

#targetObject (readonly)

Returns the value of attribute target.



53
54
55
# File 'lib/both_is_good.rb', line 53

def target
  @target
end

Instance Method Details

#apply_aliases!Object



59
60
61
62
# File 'lib/both_is_good.rb', line 59

def apply_aliases!
  target.alias_method(original, name) if aliased_original?
  target.alias_method(replacement, name) if aliased_replacement?
end