Sha256: f65ff943af9e0c2b731922c7926a0ec82ca7b35419737d7ca910bae42dba3e32

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 Bytes

Contents

# encoding: utf-8
require 'templatable_dsl_model'

module Templatable
  class Dsl
    attr_accessor :templatable

    # String Define
    [:output_fullpath, :class_name, :template].each do |f|
      define_method f do |value|
        eval "@templatable.#{f.to_s} = '#{value}'", binding
      end
    end

    # Array/Hash/Boolean Define
    [:placeholders].each do |f|
      define_method f do |value|
        eval "@templatable.#{f.to_s} = #{value}", binding
      end
    end

    def initialize
      @templatable = Templatable::DslModel.new
      @templatable.output_fullpath = 'output_fullpath'
      @templatable.class_name = 'class_name'
      @templatable.template = 'TODO: set your template(ERB format)'
      @templatable.placeholders = []
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
templatable-0.0.1 lib/templatable_dsl.rb