lib/phlex/helpers.rb in phlex-1.4.2 vs lib/phlex/helpers.rb in phlex-1.5.0

- old
+ new

@@ -3,10 +3,11 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0") using Phlex::Overrides::Symbol::Name end module Phlex::Helpers + # @return [String] 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 @@ -29,10 +30,11 @@ tokens.strip! tokens.gsub!(/\s+/, " ") tokens end + # @api private private def __append_token__(tokens, token) case token when nil then nil when String then tokens << token when Symbol then tokens << token.name @@ -40,19 +42,21 @@ else raise ArgumentError, "Conditional classes must be Symbols, Strings, or Arrays of Symbols or Strings." end end + # @return [Hash] private def classes(*tokens, **conditional_tokens) tokens = self.tokens(*tokens, **conditional_tokens) if tokens.empty? {} else { class: tokens } end end + # @return [Hash] private def mix(*args) args.each_with_object({}) do |object, result| result.merge!(object) do |_key, old, new| case new when Hash