Sha256: bb8b367ddd4d5bd4bd6c367455800b2c015d8b7399554d02cc620c1c663089fd

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

module Edtf
  module Humanize
    module Interval

      include Edtf::Humanize::Formats

      def humanize
        "#{apply_if_approximate(self.from)}#{simple_date_format(self.from)}#{Edtf::Humanize.configuration.interval_connector}#{simple_date_format(self.to)}"
      end

      private

      # '198u/199u' => 1980s to 1990s
      def apply_if_unspecified_year date
        display = date_precision(date)
        if date.respond_to? :unspecified?
          if date.unspecified? :year
            display << Edtf::Humanize.configuration.interval_unspecified_suffix
          end
        end
        display
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
edtf-humanize-0.0.6 lib/edtf/humanize/interval.rb
edtf-humanize-0.0.5 lib/edtf/humanize/interval.rb
edtf-humanize-0.0.4 lib/edtf/humanize/interval.rb
edtf-humanize-0.0.3 lib/edtf/humanize/interval.rb