diff --git a/clsx.gemspec b/clsx.gemspec index 5e3ff54..7e71d40 100644 --- a/clsx.gemspec +++ b/clsx.gemspec @@ -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 = ["isethi@me.com"] diff --git a/lib/clsx.rb b/lib/clsx.rb index 3a724c4..09c9b0a 100644 --- a/lib/clsx.rb +++ b/lib/clsx.rb @@ -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) diff --git a/lib/clsx/railtie.rb b/lib/clsx/railtie.rb index 199156b..9cbcade 100644 --- a/lib/clsx/railtie.rb +++ b/lib/clsx/railtie.rb @@ -12,7 +12,7 @@ class Railtie < Rails::Railtie module Helper def clsx(*) - Clsx.clsx(*) + CLSX.clsx(*) end end end diff --git a/lib/clsx/version.rb b/lib/clsx/version.rb index d094258..461b40f 100644 --- a/lib/clsx/version.rb +++ b/lib/clsx/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Clsx +module CLSX VERSION = "0.1.0" end diff --git a/sig/clsx.rbs b/sig/clsx.rbs index 3fe9490..0e3aac1 100644 --- a/sig/clsx.rbs +++ b/sig/clsx.rbs @@ -1,4 +1,4 @@ -module Clsx +module CLSX VERSION: String # See the writing guide of rbs: https://github.com/ruby/rbs#guides end diff --git a/test/test_clsx.rb b/test/test_clsx.rb index 85c9522..8d6f4f9 100644 --- a/test/test_clsx.rb +++ b/test/test_clsx.rb @@ -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