Sha256: edea38a8747bbbf53b3992069b6524196b35c8640914717c79c88aaec78c3777

Contents?: true

Size: 480 Bytes

Versions: 2

Compression:

Stored size: 480 Bytes

Contents

module SubDiff
  class Adapter
    extend Forwardable

    def_delegators :differ, :builder
    def_delegators :builder, :diff_method
    def_delegators :instance, :diff

    attr_reader :differ

    def initialize(differ)
      @differ = differ
    end

    private

    def instance
      adapter_class.new(differ)
    end

    def adapter_class
      Module.nesting.last.const_get(adapter_name)
    end

    def adapter_name
      diff_method.to_s.capitalize
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sub_diff-1.1.0 lib/sub_diff/adapter.rb
sub_diff-1.0.7 lib/sub_diff/adapter.rb