Sha256: cd71bc1b256cbd409fd67d8867670862b099bd5ee2e76a8309c6046006f8ef3b

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module Playbook
  module Pb<%= @kit_name_pascal %>
    class <%= @kit_name_pascal %> < Playbook::PbKit::Base
      PROPS = [<%= @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

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-2.8.3 lib/generators/kit/templates/kit_ruby.erb.tt
playbook_ui-2.8.1 lib/generators/kit/templates/kit_ruby.erb.tt