strftime_roulette 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: df16f96b9ea8bc378ea4094d15a9ec22a91ab8fd1d67864342200f2be9e7b2d4
4
+ data.tar.gz: 04a1b2eb67d44ad2183d5944e3baf94bec53cda17dc0280ca38a09d88c7e41f5
5
+ SHA512:
6
+ metadata.gz: 130c25e1fb12a409d886b18ccb2361f6b925b96ecdf28cd7775abfa1bb9c75d67f8b5f3f3cedd8582c287f9b2de9baa2682ab0fbbd21079821430bebc68419ff
7
+ data.tar.gz: 0f7ff5956e539e188fb54c479469e94e1b65740d11ce5cced62ca1ecaf0ee01899980010446d003c2a98d8b0d57e66e1e54df015d5e40677ead712ab6949e8c6
data/.DS_Store ADDED
Binary file
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ strftime_roulette (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.6.2)
10
+ rspec (3.13.2)
11
+ rspec-core (~> 3.13.0)
12
+ rspec-expectations (~> 3.13.0)
13
+ rspec-mocks (~> 3.13.0)
14
+ rspec-core (3.13.6)
15
+ rspec-support (~> 3.13.0)
16
+ rspec-expectations (3.13.5)
17
+ diff-lcs (>= 1.2.0, < 2.0)
18
+ rspec-support (~> 3.13.0)
19
+ rspec-mocks (3.13.7)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.13.0)
22
+ rspec-support (3.13.6)
23
+
24
+ PLATFORMS
25
+ arm64-darwin-24
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ rspec (~> 3.0)
30
+ strftime_roulette!
31
+
32
+ BUNDLED WITH
33
+ 2.7.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Jesse Waites
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # strftime_roulette
2
+
3
+ ![roulette](roulette.jpeg)
4
+
5
+ Because consistent date formatting is boring.
6
+
7
+ Ever looked at your app's date output and thought, "This is too predictable"? Yeah, me neither. But here we are.
8
+
9
+ **strftime_roulette** adds a `strftime_roulette` method to Date and Time objects. Every call returns a randomly formatted string. That's it. That's the gem.
10
+
11
+ ## Why?
12
+
13
+ No good reason. Sometimes you just want to write some code that makes you smile.
14
+
15
+ ## Installation
16
+
17
+ ```ruby
18
+ gem 'strftime_roulette'
19
+ ```
20
+
21
+ ## How it Works
22
+
23
+ ```ruby
24
+ require 'strftime_roulette'
25
+
26
+ Date.today.strftime_roulette
27
+ # => "2026-01-16 12:00:00"
28
+
29
+ Date.today.strftime_roulette
30
+ # => "January 16, 2026 12:00 AM"
31
+
32
+ Date.today.strftime_roulette
33
+ # => "01/16/2026 12:00:00"
34
+ ```
35
+
36
+ Each call picks a random format. You never know what you're gonna get.
37
+
38
+ ## Filter by Category
39
+
40
+ Want only date formats? Only time formats?
41
+
42
+ ```ruby
43
+ Time.now.strftime_roulette(:time)
44
+ # => "14:30:45"
45
+ # => "2:30 PM"
46
+ # => "14:30"
47
+
48
+ Date.today.strftime_roulette(:date)
49
+ # => "Thu Jan 16"
50
+ # => "January 16, 2026"
51
+ # => "01-16-2026"
52
+ ```
53
+
54
+ ## Go Atomic
55
+
56
+ Pass `single: true` to get output from a single strftime directive:
57
+
58
+ ```ruby
59
+ Date.today.strftime_roulette(:date, single: true)
60
+ # => "Thursday" # or "16" or "January" or "2026"
61
+
62
+ Time.now.strftime_roulette(:time, single: true)
63
+ # => "PM" # or "45" or "14" or "UTC"
64
+ ```
65
+
66
+ ## Arguments
67
+
68
+ | Argument | Values | Description |
69
+ |----------|--------|-------------|
70
+ | category | (none), `:date`, `:time` | Filter format type |
71
+ | `single:` | `true`/`false` | Single directive vs compound pattern |
72
+
73
+ ## Practical Uses
74
+
75
+ 1. Annoying your coworkers
76
+ 2. Testing if your UI handles various date formats gracefully
77
+ 3. Adding chaos to your development environment
78
+ 4. Making QA question their sanity
79
+
80
+ ## Available Formats
81
+
82
+ ### Date Patterns
83
+ - `%Y-%m-%d` → 2026-01-16
84
+ - `%m/%d/%Y` → 01/16/2026
85
+ - `%B %d, %Y` → January 16, 2026
86
+ - `%a %b %e` → Thu Jan 16
87
+ - `%d/%m/%Y` → 16/01/2026
88
+ - `%b %d '%y` → Jan 16 '26
89
+ - `%A, %B %d` → Thursday, January 16
90
+ - `%m-%d-%Y` → 01-16-2026
91
+ - `%e %b %Y` → 16 Jan 2026
92
+ - `%D` → 01/16/26
93
+
94
+ ### Time Patterns
95
+ - `%H:%M:%S` → 14:30:45
96
+ - `%I:%M %p` → 02:30 PM
97
+ - `%H:%M` → 14:30
98
+ - `%I:%M:%S %p` → 02:30:45 PM
99
+ - `%H:%M:%S %Z` → 14:30:45 UTC
100
+ - `%l:%M %P` → 2:30 pm
101
+
102
+ ### Combined Patterns
103
+ - `%Y-%m-%d %H:%M:%S` → 2026-01-16 14:30:45
104
+ - `%D %H:%M` → 01/16/26 14:30
105
+ - `%B %d, %Y %I:%M %p` → January 16, 2026 02:30 PM
106
+ - `%a %b %e %H:%M` → Thu Jan 16 14:30
107
+ - `%m/%d/%Y %H:%M:%S` → 01/16/2026 14:30:45
108
+
109
+ ### Single Directives
110
+
111
+ **Date:** `%a` `%A` `%w` `%u` `%d` `%e` `%j` `%U` `%V` `%b` `%B` `%m` `%y` `%Y` `%C`
112
+
113
+ **Time:** `%S` `%L` `%s` `%M` `%H` `%I` `%k` `%l` `%p` `%P` `%Z`
114
+
115
+ ## Disclaimer
116
+
117
+ Please do not use this in production. Unless you want to. I'm not your boss.
118
+
119
+ ## License
120
+
121
+ MIT
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
data/blog.md ADDED
@@ -0,0 +1,75 @@
1
+ # Introducing strftime_roulette: Because Consistent Date Formatting is Boring
2
+
3
+ Ever looked at your app's date output and thought, "This is too predictable"? Yeah, me neither. But here we are.
4
+
5
+ I'm releasing **strftime_roulette**, a Ruby gem that adds a `strftime_roulette` method to Date and Time objects. Every call returns a randomly formatted string. That's it. That's the gem.
6
+
7
+ ## Why?
8
+
9
+ No good reason. Sometimes you just want to write some code that makes you smile.
10
+
11
+ ## How it Works
12
+
13
+ ```ruby
14
+ require 'strftime_roulette'
15
+
16
+ Date.today.strftime_roulette
17
+ # => "2026-01-16 12:00:00"
18
+
19
+ Date.today.strftime_roulette
20
+ # => "January 16, 2026 12:00 AM"
21
+
22
+ Date.today.strftime_roulette
23
+ # => "01/16/2026 12:00:00"
24
+ ```
25
+
26
+ Each call picks a random format. You never know what you're gonna get.
27
+
28
+ ## Filter by Category
29
+
30
+ Want only date formats? Only time formats? You can do that:
31
+
32
+ ```ruby
33
+ Time.now.strftime_roulette(:time)
34
+ # => "14:30:45"
35
+ # => "2:30 PM"
36
+ # => "14:30"
37
+
38
+ Date.today.strftime_roulette(:date)
39
+ # => "Thu Jan 16"
40
+ # => "January 16, 2026"
41
+ # => "01-16-2026"
42
+ ```
43
+
44
+ ## Go Atomic
45
+
46
+ Pass `single: true` to get output from a single strftime directive:
47
+
48
+ ```ruby
49
+ Date.today.strftime_roulette(:date, single: true)
50
+ # => "Thursday" # or "16" or "January" or "2026"
51
+
52
+ Time.now.strftime_roulette(:time, single: true)
53
+ # => "PM" # or "45" or "14" or "UTC"
54
+ ```
55
+
56
+ ## Practical Uses
57
+
58
+ 1. Annoying your coworkers
59
+ 2. Testing if your UI handles various date formats gracefully
60
+ 3. Adding chaos to your development environment
61
+ 4. Making QA question their sanity
62
+
63
+ ## Installation
64
+
65
+ ```ruby
66
+ gem 'strftime_roulette'
67
+ ```
68
+
69
+ ## Disclaimer
70
+
71
+ Please do not use this in production. Unless you want to. I'm not your boss.
72
+
73
+ ---
74
+
75
+ [GitHub](https://github.com/jessewaites/strftime_roulette) | MIT License
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "formats"
4
+
5
+ module StrftimeRoulette
6
+ module CoreExt
7
+ def strftime_roulette(category = nil, single: false)
8
+ format = pick_format(category, single)
9
+ strftime(format)
10
+ rescue StandardError
11
+ to_s
12
+ end
13
+
14
+ private
15
+
16
+ def pick_format(category, single)
17
+ case category
18
+ when :time
19
+ single ? Formats::TIME_DIRECTIVES.sample : Formats::TIME_PATTERNS.sample
20
+ when :date
21
+ single ? Formats::DATE_DIRECTIVES.sample : Formats::DATE_PATTERNS.sample
22
+ else
23
+ Formats::COMBINED_PATTERNS.sample
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ class Date
30
+ include StrftimeRoulette::CoreExt
31
+ end
32
+
33
+ class Time
34
+ include StrftimeRoulette::CoreExt
35
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StrftimeRoulette
4
+ module Formats
5
+ TIME_DIRECTIVES = %w[%S %L %s %M %H %I %k %l %p %P %Z].freeze
6
+
7
+ DATE_DIRECTIVES = %w[%a %A %w %u %d %e %j %U %V %b %B %m %y %Y %C].freeze
8
+
9
+ TIME_PATTERNS = [
10
+ "%H:%M:%S",
11
+ "%I:%M %p",
12
+ "%H:%M",
13
+ "%I:%M:%S %p",
14
+ "%H:%M:%S %Z",
15
+ "%l:%M %P"
16
+ ].freeze
17
+
18
+ DATE_PATTERNS = [
19
+ "%Y-%m-%d",
20
+ "%m/%d/%Y",
21
+ "%B %d, %Y",
22
+ "%a %b %e",
23
+ "%d/%m/%Y",
24
+ "%b %d '%y",
25
+ "%A, %B %d",
26
+ "%m-%d-%Y",
27
+ "%e %b %Y",
28
+ "%D"
29
+ ].freeze
30
+
31
+ COMBINED_PATTERNS = [
32
+ "%Y-%m-%d %H:%M:%S",
33
+ "%D %H:%M",
34
+ "%B %d, %Y %I:%M %p",
35
+ "%a %b %e %H:%M",
36
+ "%m/%d/%Y %H:%M:%S"
37
+ ].freeze
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StrftimeRoulette
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require_relative "strftime_roulette/version"
5
+ require_relative "strftime_roulette/formats"
6
+ require_relative "strftime_roulette/core_ext"
7
+
8
+ module StrftimeRoulette
9
+ end
data/roulette.jpeg ADDED
Binary file
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/strftime_roulette/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "strftime_roulette"
7
+ spec.version = StrftimeRoulette::VERSION
8
+ spec.authors = ["Jesse Waites"]
9
+ spec.email = ["jesse@example.com"]
10
+
11
+ spec.summary = "Random strftime formatting for Date and Time"
12
+ spec.description = "Adds strftime_roulette method to Date and Time classes, returning randomly formatted date/time strings"
13
+ spec.homepage = "https://github.com/jessewaites/strftime_roulette"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.7.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+
20
+ spec.files = Dir.chdir(__dir__) do
21
+ `git ls-files -z`.split("\x0").reject do |f|
22
+ (File.expand_path(f) == __FILE__) ||
23
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github])
24
+ end
25
+ end
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: strftime_roulette
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jesse Waites
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-01-16 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rspec
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '3.0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '3.0'
26
+ description: Adds strftime_roulette method to Date and Time classes, returning randomly
27
+ formatted date/time strings
28
+ email:
29
+ - jesse@example.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".DS_Store"
35
+ - ".rspec"
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - blog.md
42
+ - lib/strftime_roulette.rb
43
+ - lib/strftime_roulette/core_ext.rb
44
+ - lib/strftime_roulette/formats.rb
45
+ - lib/strftime_roulette/version.rb
46
+ - roulette.jpeg
47
+ - strftime_roulette.gemspec
48
+ homepage: https://github.com/jessewaites/strftime_roulette
49
+ licenses:
50
+ - MIT
51
+ metadata:
52
+ homepage_uri: https://github.com/jessewaites/strftime_roulette
53
+ source_code_uri: https://github.com/jessewaites/strftime_roulette
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.7.0
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.6.6
69
+ specification_version: 4
70
+ summary: Random strftime formatting for Date and Time
71
+ test_files: []