Sha256: dabc089f47f5d8c7430fd02989eee3266b5fb7cef897d5ae7bfba54f2aa40220

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Yattho
  # :nodoc:
  module Audited
    # DSL to register when a component has passed an accessibility audit.
    #
    # Example:
    #
    # class MyComponent < ViewComponent::Base
    #   include Yattho::Audited::Dsl
    #   audited_at 'YYYY-MM-DD'
    # end
    module Dsl
      extend ActiveSupport::Concern

      included do
        class_attribute :audit_date, instance_writer: false
      end

      class_methods do
        def audited_at(date = nil)
          return audit_date if date.nil?

          self.audit_date = date
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 app/lib/yattho/audited/dsl.rb
yattho_view_components-0.0.1 app/lib/yattho/audited/dsl.rb