Sha256: a425deb14af3ba301d164562be13b5e98a98f2ed1c6dfbd25d12f24507fb6df2

Contents?: true

Size: 538 Bytes

Versions: 4

Compression:

Stored size: 538 Bytes

Contents

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

      def call
        [].tap do |result|
          converter_methods.each do |method_name|
            self.public_send(method_name, to_convert, result)
          end
        end
      end

      module ClassMethods
        def converter_proc(to, from)
          -> (to_convert, result){
            result[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_array_mapping.rb
yaoc-0.0.3 lib/yaoc/strategies/to_array_mapping.rb
yaoc-0.0.2 lib/yaoc/strategies/to_array_mapping.rb
yaoc-0.0.1 lib/yaoc/strategies/to_array_mapping.rb