Sha256: 999eb6d5e950b03dd9542f2c4b0c1b812524596a25fc5083ac665470aff68fdf

Contents?: true

Size: 489 Bytes

Versions: 11

Compression:

Stored size: 489 Bytes

Contents

module Danica::VariablesHolder
  class AliasBuilder

    attr_reader :clazz, :origin, :destiny

    def initialize(origin, destiny, clazz)
      @origin = origin
      @destiny = destiny
      @clazz = clazz
    end

    def build
      clazz.variables_hash.change_keys! { |k| k == origin ? destiny : k }
      VariablesBuilder.new([ destiny ], clazz).build
      clazz.send(:alias_method, "#{origin}=", "#{destiny}=")
      clazz.send(:alias_method, origin, destiny)
    end  
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
danica-2.7.4 lib/danica/variables_holder/alias_builder.rb
danica-2.7.3 lib/danica/variables_holder/alias_builder.rb
danica-2.7.2 lib/danica/variables_holder/alias_builder.rb
danica-2.7.1 lib/danica/variables_holder/alias_builder.rb
danica-2.6.4 lib/danica/variables_holder/alias_builder.rb
danica-2.6.3 lib/danica/variables_holder/alias_builder.rb
danica-2.6.2 lib/danica/variables_holder/alias_builder.rb
danica-2.6.1 lib/danica/variables_holder/alias_builder.rb
danica-2.6.0 lib/danica/variables_holder/alias_builder.rb
danica-2.5.1 lib/danica/variables_holder/alias_builder.rb
danica-2.5.0 lib/danica/variables_holder/alias_builder.rb