Sha256: e4fb9518f492592a5b648037b3aa18df940c12661645820a36717be449145285

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

module Edtf
  module Humanize
    module Language
      module Default
        module Season
          include Edtf::Humanize::Language::Default::Formats

          extend self

          def humanizer(date)
            "#{apply_prefix_if_approximate(date)}"\
            "#{translate_season(date.season)} #{date.year}"\
            "#{apply_suffix_if_approximate(date)}"\
            "#{apply_if_uncertain(date)}"
          end

          private

          def translate_season(season)
            I18n.translate!("date.seasons.#{season}")
          rescue I18n::MissingTranslationData
            season
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
edtf-humanize-2.1.0 lib/edtf/humanize/language/default/season.rb
edtf-humanize-2.0.1 lib/edtf/humanize/language/default/season.rb
edtf-humanize-2.0.0 lib/edtf/humanize/language/default/season.rb