Sha256: b3a8d040240f7e15f45427d953551be80551ec2e1ac3f80b2defcc8a8aac958f

Contents?: true

Size: 1.25 KB

Versions: 24

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

puts 'xxxxxxx'
class HandlebarsHelperBuilder < KDirector::Builders::ActionsBuilder
  attr_reader :current_helper
  # attr_accessor :actions
  # attr_accessor :last_action

  def initialize
    super

    dom[:helpers] = []
    # @actions = []
    # @last_action = {}
  end

  def helpers
    dom[:helpers]
  end

  def add_helper
    @current_helper = new_helper
    dom[:helpers] << current_helper
  end

  def helper_setting(name, value)
    @current_helper[name] = value
  end

  def add_helper_parameter(name, description, splat: false)
    parameter = {
      name: name,
      description: description,
      splat: splat
    }

    @current_helper[:parameters] << parameter
  end

  def add_helper_example(value)
    lines = value.split("\n")
    value = lines.map { |line| "        # #{line.strip}" }.join("\n")

    @current_helper[:examples] << value
  end


  private

  def new_helper
    {
      name: nil,
      description: nil,
      result: nil,
      category: nil,
      category_description: nil,
      base_class_require: nil,
      base_class: nil,
      example_input_value: nil,
      example_output_value: nil,
      test_input_value: nil,
      test_output_value: nil,
      parameters: [],
      examples: []
    }
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
handlebarsjs-0.14.2 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.14.1 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.14.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.13.1 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.13.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.12.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.11.3 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.11.2 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.11.1 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.11.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.10.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.9.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.8.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.7.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.6.3 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.6.2 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.6.1 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.6.0 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.5.7 .builders/director/handlebars_helper_builder.rb
handlebarsjs-0.5.6 .builders/director/handlebars_helper_builder.rb