Sha256: 6ddb922c4c4f4bb8f5041f06653aedb3cb9bb06beb67848fccb96d3fe063faea

Contents?: true

Size: 515 Bytes

Versions: 4

Compression:

Stored size: 515 Bytes

Contents

module Yaoc
  module Strategies
    module ToHashMapping
      def self.included(other)
        other.extend(ClassMethods)
      end

      def call
        converter_methods.reduce({}) do |result, method_name|
          self.public_send(method_name, to_convert, result)
        end
      end

      module ClassMethods
        def converter_proc(to, from)
          -> (to_convert, result){
            result.merge({to => to_convert.public_send(fetcher, from)})
          }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yaoc-0.0.4 lib/yaoc/strategies/to_hash_mapping.rb
yaoc-0.0.3 lib/yaoc/strategies/to_hash_mapping.rb
yaoc-0.0.2 lib/yaoc/strategies/to_hash_mapping.rb
yaoc-0.0.1 lib/yaoc/strategies/to_hash_mapping.rb