Sha256: be34f241e0c410fc6122547ab87c3970358ee18485bf9cc75539f4026406a0dc
Contents?: true
Size: 454 Bytes
Versions: 25
Compression:
Stored size: 454 Bytes
Contents
# frozen_string_literal: true class StimulusReflex::Element attr_reader :attributes delegate :[], to: :"@attributes" def initialize(attrs = {}) @attributes = HashWithIndifferentAccess.new(attrs || {}).freeze end def dataset @dataset ||= attributes.each_with_object(HashWithIndifferentAccess.new) { |(key, value), memo| next unless key.start_with?("data-") memo[key.delete_prefix("data-")] = value }.freeze end end
Version data entries
25 entries across 25 versions & 1 rubygems