Sha256: fbd6c815371a25761e188e0769aa69e964733735fd5cef4cc73d435b46715497

Contents?: true

Size: 978 Bytes

Versions: 80

Compression:

Stored size: 978 Bytes

Contents

# (Documentation in 3.x stub)
#
# @since 4.8.0
#
Puppet::Functions.create_function(:strftime) do
  dispatch :format_timespan do
    param 'Timespan', :time_object
    param 'String', :format
  end

  dispatch :format_timestamp do
    param 'Timestamp', :time_object
    param 'String', :format
    optional_param 'String', :timezone
  end

  dispatch :legacy_strftime do
    param 'String', :format
    optional_param 'String', :timezone
  end

  def format_timespan(time_object, format)
    time_object.format(format)
  end

  def format_timestamp(time_object, format, timezone = nil)
    time_object.format(format, timezone)
  end

  def legacy_strftime(format, timezone = nil)
    Puppet.warn_once('deprecation', 'legacy#strftime',
      'The argument signature (String format, [String timezone]) is deprecated for #strfime. See #strftime documentation and Timespan type for more info')
    Puppet::Pops::Time::Timestamp.format_time(format, Time.now.utc, timezone)
  end
end

Version data entries

80 entries across 80 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/functions/strftime.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/functions/strftime.rb
puppet-4.10.12 lib/puppet/functions/strftime.rb
puppet-4.10.12-x86-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.12-x64-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.12-universal-darwin lib/puppet/functions/strftime.rb
puppet-4.10.11 lib/puppet/functions/strftime.rb
puppet-4.10.11-x86-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.11-x64-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.11-universal-darwin lib/puppet/functions/strftime.rb
puppet-4.10.10 lib/puppet/functions/strftime.rb
puppet-4.10.10-x86-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.10-x64-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.10-universal-darwin lib/puppet/functions/strftime.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/functions/strftime.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/functions/strftime.rb
puppet-4.10.9 lib/puppet/functions/strftime.rb
puppet-4.10.9-x86-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.9-x64-mingw32 lib/puppet/functions/strftime.rb
puppet-4.10.9-universal-darwin lib/puppet/functions/strftime.rb