Sha256: 0ef04f53d8595a52210ff4ac8b1768a3ebdc82880aa968320e038a692ad9708d

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

module DataBuilder
  module DateGeneration
    def today(format = '%D')
      Date.today.strftime(format)
    end

    def tomorrow(format = '%D')
      tomorrow = Date.today + 1
      tomorrow.strftime(format)
    end

    def yesterday(format = '%D')
      yesterday = Date.today - 1
      yesterday.strftime(format)
    end

    def month
      randomize(Date::MONTHNAMES[1..-1])
    end

    def month_abbr
      randomize(Date::ABBR_MONTHNAMES[1..-1])
    end

    def day_of_week
      randomize(Date::DAYNAMES)
    end

    def day_of_week_abbr
      randomize(Date::ABBR_DAYNAMES)
    end

    alias db_today today
    alias dn_tomorrow tomorrow
    alias db_yesterday yesterday
    alias db_month month
    alias db_month_abbr month_abbr
    alias db_day_of_week day_of_week
    alias db_day_of_week_abbr day_of_week_abbr
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
data_builder-2.0.0 lib/data_builder/generation_date.rb