lib/phlex/helpers.rb in phlex-1.0.0.rc2 vs lib/phlex/helpers.rb in phlex-1.0.0
- old
+ new
@@ -3,11 +3,11 @@
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
using Overrides::Symbol::Name
end
module Phlex::Helpers
- def tokens(*tokens, **conditional_tokens)
+ private def tokens(*tokens, **conditional_tokens)
conditional_tokens.each do |condition, token|
truthy = case condition
when Symbol then send(condition)
when Proc then condition.call
else raise ArgumentError, "The class condition must be a Symbol or a Proc."
@@ -26,31 +26,31 @@
end
tokens.join(" ")
end
- def _append_token(tokens, token)
+ private def _append_token(tokens, token)
case token
when nil then nil
when String then tokens << token
when Symbol then tokens << token.name
when Array then tokens.concat(token)
else raise ArgumentError,
"Conditional classes must be Symbols, Strings, or Arrays of Symbols or Strings."
end
end
- def classes(*tokens, **conditional_tokens)
+ private def classes(*tokens, **conditional_tokens)
tokens = self.tokens(*tokens, **conditional_tokens)
if tokens.empty?
{}
else
{ class: tokens }
end
end
- def mix(*args)
+ private def mix(*args)
args.each_with_object({}) do |object, result|
result.merge!(object) do |_key, old, new|
case new
when Hash
old.is_a?(Hash) ? mix(old, new) : new