Method: AblyUi::Core::Util#append_random_postfix
- Defined in:
- lib/ably_ui/core/core.rb
#append_random_postfix(id) ⇒ Object
This is useful where we need to use an HTML id (like in aria-controls attribute) but we know the component might be used multiple times per page so we can’t just hard code one in HTML. eg. my-component -> my-component-uur0cj2h credits gist.github.com/mbajur/2aba832a6df3fc31fe7a82d3109cb626
76 77 78 |
# File 'lib/ably_ui/core/core.rb', line 76 def append_random_postfix(id) "#{id}-#{rand(36**8).to_s(36)}" end |