--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Adds a template to this generator. Templates are named and can later be retrieved by that name. Templates have a source and a destination. When a template is invoked, the source file is rendered, passing through ERB, and the result is copied to the destination. Source and destination can be specified in different ways, and are always assumed to be relative to source_root and destination_root.
- !ruby/struct:SM::Flow::P 
  body: If only a destination is given, the source is assumed to be the same destination, only appending the letter 't', so a destination of 'app/model.rb', would assume a source of 'app/model.rbt'
- !ruby/struct:SM::Flow::P 
  body: Source and destination can be set in a block, which makes it possible to call instance methods to determine the correct source and/or desination.
- !ruby/struct:SM::Flow::P 
  body: A hash of options can be passed, these options are matched against the options passed to the generator. Some special options, for callbacks for example, are also supported, see below.
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Parameters
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "name<Symbol>:"
    body: The name of this template
  - !ruby/struct:SM::Flow::LI 
    label: "source<String>:"
    body: The source template, can be omitted
  - !ruby/struct:SM::Flow::LI 
    label: "destination<String>:"
    body: The destination where the result will be put.
  - !ruby/struct:SM::Flow::LI 
    label: "options<Hash>:"
    body: Options for this template
  - !ruby/struct:SM::Flow::LI 
    label: "&block<Proc>:"
    body: A block to execute when the generator is instantiated
  type: :NOTE
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Options
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: ":before<Symbol>:"
    body: Name of a method to execute before this template is invoked
  - !ruby/struct:SM::Flow::LI 
    label: ":after<Symbol>:"
    body: Name of a method to execute after this template is invoked
  type: :NOTE
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Examples
- !ruby/struct:SM::Flow::VERB 
  body: "  class MyGenerator &lt; Templater::Generator\n    def random\n      rand(100000).to_s\n    end\n\n    template :one, 'template.rb' # source will be inferred as 'template.rbt'\n    template :two, 'source.rbt', 'template.rb' # source expicitly given\n    template :three do\n      source('source.rbt')\n      destination(&quot;#{random}.rb&quot;)\n    end\n  end\n"
full_name: Templater::Generator::template
is_singleton: true
name: template
params: (name, *args, &block)
visibility: public
