Skip to content

Commit

Permalink
capitalize clsx
Browse files Browse the repository at this point in the history
  • Loading branch information
SethHorsley committed Mar 3, 2024
1 parent 0828b34 commit 5c39e3d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion clsx.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require_relative "lib/clsx/version"

Gem::Specification.new do |spec|
spec.name = "clsx"
spec.version = Clsx::VERSION
spec.version = CLSX::VERSION
spec.authors = ["Seth Horsley"]
spec.email = ["[email protected]"]

Expand Down
2 changes: 1 addition & 1 deletion lib/clsx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative "clsx/version"
require "clsx/railtie" if defined?(Rails)

module Clsx
module CLSX
class Error < StandardError; end

def self.clsx(*args)
Expand Down
2 changes: 1 addition & 1 deletion lib/clsx/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Railtie < Rails::Railtie

module Helper
def clsx(*)
Clsx.clsx(*)
CLSX.clsx(*)
end
end
end
2 changes: 1 addition & 1 deletion lib/clsx/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Clsx
module CLSX
VERSION = "0.1.0"
end
2 changes: 1 addition & 1 deletion sig/clsx.rbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Clsx
module CLSX
VERSION: String
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
end
12 changes: 6 additions & 6 deletions test/test_clsx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@

class ClsxTest < Minitest::Test
def test_strings
assert_equal "foo bar baz", Clsx.clsx("foo", true && "bar", "baz")
assert_equal "foo bar baz", CLSX.clsx("foo", true && "bar", "baz")
end

def test_objects
assert_equal "foo baz", Clsx.clsx({foo: true, bar: false, baz: true})
assert_equal "foo baz", CLSX.clsx({foo: true, bar: false, baz: true})
end

def test_objects_variadic
assert_equal "foo --foobar", Clsx.clsx({foo: true}, {bar: false}, nil, {"--foobar" => "hello"})
assert_equal "foo --foobar", CLSX.clsx({foo: true}, {bar: false}, nil, {"--foobar" => "hello"})
end

def test_arrays
assert_equal "foo bar", Clsx.clsx(["foo", 0, false, "bar"])
assert_equal "foo bar", CLSX.clsx(["foo", 0, false, "bar"])
end

def test_arrays_variadic
assert_equal "foo bar baz hello there", Clsx.clsx(["foo"], ["", 0, false, "bar"], [["baz", [["hello"], "there"]]])
assert_equal "foo bar baz hello there", CLSX.clsx(["foo"], ["", 0, false, "bar"], [["baz", [["hello"], "there"]]])
end

def test_kitchen_sink
assert_equal "foo bar hello world cya", Clsx.clsx("foo", [1 && "bar", {baz: false, bat: nil}, ["hello", ["world"]]], "cya")
assert_equal "foo bar hello world cya", CLSX.clsx("foo", [1 && "bar", {baz: false, bat: nil}, ["hello", ["world"]]], "cya")
end
end

0 comments on commit 5c39e3d

Please sign in to comment.