niceties 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: 5a344de89699dbdc123ebe5cd16c0457e0b35b7ef3717db07348415b752b6b75
4
+ data.tar.gz: 3a4f87520eb6808cc9998720aa283f84a6841f9f5505f1d4d6faf02773314441
5
+ SHA512:
6
+ metadata.gz: d05d3be08f1576176537516acedead938c049985e81a5e6ac143d90b3b1af477e2a95110da8209355630ecef5a9dd360f2c34e4bd12c0d2de5c3a28b7a4e53dd
7
+ data.tar.gz: e21eb52f1c78b876fb340f3b276eb210c1c96dacea0491f23d700e13e20e777e0fd98f4a5652c5f84f9433c5cf2711533283f6588a5b4ac44ca89b53e4ca0272
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in niceties.gemspec
6
+ gemspec
7
+
8
+ gem "irb"
9
+ gem "rake", "~> 13.0"
10
+
11
+ gem "minitest", "~> 5.16"
12
+
13
+ gem "rubocop", "~> 1.21"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Carl Dawson
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,40 @@
1
+ # Niceties
2
+
3
+ Niceties is a curated collection of small, thoughtful additions to Rails.
4
+ Nothing fancy, nothing heavy — just expressive, elegant helpers that make
5
+ everyday code smoother and more joyful.
6
+
7
+ It’s the kind of thing you might monkey-patch in your own app and forget about. Niceties gives those private little helpers a permanent, public home.
8
+
9
+ ---
10
+
11
+ ## ✨ Philosophy
12
+
13
+ Niceties is built on a few quiet principles:
14
+
15
+ - **Ergonomics matter.** Tiny syntax improvements compound across projects and years.
16
+ - **Less is more.** This isn’t a kitchen sink. Every addition is judged by feel.
17
+ - **No surprises.** If you have to explain what it’s doing, it probably doesn’t belong here.
18
+ - **Ruby’s voice, not ours.** Every method should *read* like Ruby. Nothing flashy, nothing clever for its own sake.
19
+
20
+ You should be able to drop Niceties into your app and feel like it’s always been there.
21
+
22
+ ---
23
+
24
+ ## 🫂 Contributing
25
+
26
+ Niceties is open to anyone with an idea that makes Ruby or Rails feel better to use.
27
+
28
+ If you’ve ever written a helper method and thought:
29
+
30
+ > _"This is too small for a gem, but I wish it lived somewhere..."_
31
+
32
+ That’s exactly what Niceties is for.
33
+
34
+ **Guiding questions for contributors:**
35
+
36
+ - Does this make everyday code more readable or expressive?
37
+ - Does it align with Ruby’s style and philosophy?
38
+ - Would I be delighted if this existed in the language?
39
+
40
+ If yes — open a PR or start a discussion.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[test rubocop]
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "niceties"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require "irb"
11
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,25 @@
1
+ class Object
2
+ def not_a?(klass)
3
+ !is_a?(klass)
4
+ end
5
+
6
+ def try_all(*methods)
7
+ methods.each do |method|
8
+ result = try(method)
9
+ return result unless result.nil?
10
+ end
11
+
12
+ nil
13
+ end
14
+
15
+ def coalesce(*messages)
16
+ *methods, fallback = messages
17
+
18
+ methods.each do |method|
19
+ result = try(method)
20
+ return result if result.present?
21
+ end
22
+
23
+ fallback.is_a?(Symbol) ? try(fallback) : fallback
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Niceties
4
+ VERSION = "0.1.0"
5
+ end
data/lib/niceties.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/object/try"
4
+ require "active_support/core_ext/object/blank"
5
+ require_relative "niceties/version"
6
+ require_relative "niceties/object"
7
+
8
+ module Niceties
9
+ end
data/sig/niceties.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Niceties
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: niceties
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Carl Dawson
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: activesupport
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '6.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '6.0'
26
+ description: Niceties is a carefully curated set of ergonomic Ruby and Rails extensions—small,
27
+ expressive methods that make code feel more natural and joyful to write.
28
+ email:
29
+ - email@carldaws.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - ".rubocop.yml"
36
+ - Gemfile
37
+ - LICENSE.txt
38
+ - README.md
39
+ - Rakefile
40
+ - bin/console
41
+ - bin/setup
42
+ - lib/niceties.rb
43
+ - lib/niceties/object.rb
44
+ - lib/niceties/version.rb
45
+ - sig/niceties.rbs
46
+ homepage: https://github.com/carldaws/niceties
47
+ licenses:
48
+ - MIT
49
+ metadata:
50
+ allowed_push_host: https://rubygems.org
51
+ homepage_uri: https://github.com/carldaws/niceties
52
+ source_code_uri: https://github.com/carldaws/niceties
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 3.1.0
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.6.7
68
+ specification_version: 4
69
+ summary: A collection of thoughtful Ruby and Rails helpers.
70
+ test_files: []