Sha256: 06fd0bf5102c5bdb99f907dd97c468acca6e70b01ca4195c4a584af7ac9e1f14

Contents?: true

Size: 475 Bytes

Versions: 7

Compression:

Stored size: 475 Bytes

Contents

# frozen_string_literal: true

module Hanamimastery
  module CLI
    module Transformations
      class Touch
        PATTERN = /^modifiedAt\:[[:space:]]"\d{4}-\d{2}-\d{2}"$/

        # Updates the modifiedAt with the passed date
        #
        def call(content, timestamp: nil)
          timestamp ||= Time.now
          content.gsub(
            PATTERN,
            %(modifiedAt: "#{timestamp.strftime("%Y-%M-%d")}")
          )
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hanamimastery-cli-0.4.0 lib/hanamimastery/cli/transformations/touch.rb
hanamimastery-cli-0.3.1 lib/hanamimastery/cli/transformations/touch.rb
hanamimastery-cli-0.3.0 lib/hanamimastery/cli/transformations/touch.rb
hanamimastery-cli-0.2.2 lib/hanamimastery/cli/transformations/touch.rb
hanamimastery-cli-0.2.1 lib/hanamimastery/cli/transformations/touch.rb
hanamimastery-cli-0.2.0 lib/hanamimastery/cli/transformations/touch.rb
hanamimastery-cli-0.1.0 lib/hanamimastery/cli/transformations/touch.rb