Sha256: 786202d6be932d7d5b9b03570dcb57cc6a8e09301344f3a1a69e4b831b580bab

Contents?: true

Size: 359 Bytes

Versions: 2

Compression:

Stored size: 359 Bytes

Contents

module Stamp
  module Emitters
    class Delegate
      include Modifiable

      attr_reader :field

      # @param [field] the field to be formatted (e.g. +:month+, +:year+)
      def initialize(field, &block)
        @field = field
        @modifier = block
      end

      def format(target)
        modify(target.send(field))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stamp-0.6.0 lib/stamp/emitters/delegate.rb
stamp-0.5.0 lib/stamp/emitters/delegate.rb