lib/lookbook/support/utils/attribute_utils.rb in lookbook-1.2.1 vs lib/lookbook/support/utils/attribute_utils.rb in lookbook-1.3.0

- old
+ new

@@ -1,9 +1,14 @@ module Lookbook module AttributeUtils class << self def dom_id(*args) - ["lookbook", *args].join("-").parameterize.dasherize + entity_id(["lookbook", *args]) + end + + def entity_id(*args) + parts = args.map { |arg| arg.to_s.force_encoding("UTF-8").parameterize.dasherize } + parts.join("-").tr("/_", "-").delete_prefix("-").delete_suffix("-").gsub("--", "-") end end end end