Sha256: 2bb8b6ba18cb70b58f010e2ec1974050d490295eab8aacbd57c42e26af16e3ca

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Playbook
  module Pb<%= @kit_name_pascal %>
    class <%= @kit_name_pascal %> < Playbook::PbKit::Base
      PROPS = %i[<%= @kit_props.map{|key,val| "configured_#{key.parameterize.underscore}".to_sym }.join("\n\t\t\t\t\t") %>].freeze

      def initialize(<%= @kit_class_init.join(",\n\t\t\t\t\t\t\t") %>)
        <%= @kit_class_val.join("\n\t\t\t\t") %>
      end
      <% @unique_props.each do |key, val| %>
      def <%= key.to_s.underscore %><% case val %><% when "array", "arr" %>
        <%= key.to_s.underscore %>_options = %w(option1 option2)
        one_of_value(configured_<%= key.to_s.underscore %>, <%= key.to_s.underscore %>_options, "")<% when "boolean", "bool" %>
        true_value(configured_<%= key.to_s.underscore %>, "true value", "false value")<% else %>
        default_value(configured_<%= key.to_s.underscore %>, "")<% end %>
      end
      <% end %>

      def to_partial_path
        "<%= "pb_#{@kit_name_underscore}/#{@kit_name_underscore}" %>"
      end

    private

      DEFAULT = Object.new
      private_constant :DEFAULT
      def default_configuration
        DEFAULT
      end
      attr_accessor(*PROPS)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-2.8.9 lib/generators/kit/templates/kit_ruby.erb.tt
playbook_ui-2.8.8 lib/generators/kit/templates/kit_ruby.erb.tt
playbook_ui-2.8.7 lib/generators/kit/templates/kit_ruby.erb.tt
playbook_ui-2.8.6 lib/generators/kit/templates/kit_ruby.erb.tt
playbook_ui-2.8.5 lib/generators/kit/templates/kit_ruby.erb.tt
playbook_ui-2.8.4 lib/generators/kit/templates/kit_ruby.erb.tt