Sha256: a06c8e5fe6060b651e506391b96f202bbdfddf0dd0dbb3d3f21ca5bdbed9f8bf

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

module Magicka
  class Element
    # @api private
    #
    # class responsible for building methods on {Magicka::Element}
    class MethodBuilder < Sinclair
      # adds a mehtod +#template+
      #
      # The method will always return the template given in the params
      #
      # @param template [String] path to template file
      #
      # @return [Array<Sinclair::MethodDefinition>]
      def add_template(template)
        add_method(:template, cached: true) do
          template
        end

        build
      end

      # adds a mehtod +#template_folder+
      #
      # The method will always return the template folder given in the params
      #
      # @param template_folder [String] path to template folder
      #
      # @return [Array<Sinclair::MethodDefinition>]
      def add_template_folder(folder)
        add_method(:template_folder) do
          folder
        end

        build
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
magicka-0.5.6 lib/magicka/element/method_builder.rb
magicka-0.5.5 lib/magicka/element/method_builder.rb
magicka-0.5.4 lib/magicka/element/method_builder.rb