Sha256: e60e0ffc46a5dd2349cb3b111f8263bc8c44713b03ff78810253080c770d12ed

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

module HyperI18n
  class Localize < Hyperstack::ServerOp
    include HelperMethods

    param :acting_user, nils: true
    param :date_or_time
    param :format
    param :opts
    param :localization, default: nil

    def date_or_time
      @date_or_time ||= formatted_date_or_time(params.date_or_time)
    end

    def opts
      @opts ||= params.opts.with_indifferent_access
                      .merge(format: formatted_format(params.format))
                      .symbolize_keys
    end

    step do
      params.localization = ::I18n.l(date_or_time, opts)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hyper-i18n-1.0.alpha1.8 lib/hyper-i18n/operations/localize.rb
hyper-i18n-1.0.alpha1.7 lib/hyper-i18n/operations/localize.rb
hyper-i18n-1.0.alpha1.6 lib/hyper-i18n/operations/localize.rb
hyper-i18n-1.0.alpha1.5 lib/hyper-i18n/operations/localize.rb