Sha256: 744f098ef32eb10eb2ba7ec2b11a0e00ad7345a46d48313ef4387aa3fedb3b74

Contents?: true

Size: 702 Bytes

Versions: 15

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true
module UiComponents
  module DocuCop
    extend ActiveSupport::Concern

    class_methods do
      def name
        to_s.underscore.sub(/_cell\Z/, '')
      end

      def title
        name.titleize
      end

      def examples
        documentation[:examples].presence ||
          raise("No examples provided for #{name} component")
      end

      def description
        documentation[:description].presence ||
          raise("No description provided for '#{name}' component")
      end

      def documentation
        file = Engine.root.join('app', 'cells', name, "#{name}.yml")
        YAML.load(File.read(file)).deep_symbolize_keys
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ad2games-ui_components-2.3.0 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.1.0 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.14 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.12 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.11 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.10 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.9 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.8 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.7 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.5 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.4 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.3 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.2 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.1 lib/ui_components/docu_cop.rb
ad2games-ui_components-2.0.0 lib/ui_components/docu_cop.rb