Sha256: 92127f6da548fd03dc090d5e10278a6266ab89b327ae60f0152db89fe9bcce90

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 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 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-1.1.0 lib/magicka/element/method_builder.rb
magicka-1.0.0 lib/magicka/element/method_builder.rb
magicka-0.6.0 lib/magicka/element/method_builder.rb