Class: Templater::Actions::Action

### Home Classes Methods

### In Files

- lib/templater/actions/action.rb

### Parent

Object

### Methods

- #callback
- #convert_encoded_instructions
- #destination=
- #relative_destination
- #source=

### Files

- History.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Templater
- Templater::ActionDescription
- Templater::Actions
- Templater::Actions::Action
- Templater::Actions::Directory
- Templater::Actions::EmptyDirectory
- Templater::Actions::File
- Templater::Actions::Template
- Templater::ArgumentDescription
- Templater::CLI
- Templater::CLI::Generator
- Templater::CLI::Manifold
- Templater::Description
- Templater::Discovery
- Templater::Generator
- Templater::InvocationDescription
- Templater::Manifold
- Templater::Spec
- Templater::Spec::Helpers
- Templater::Spec::Helpers::CreateMatcher
- Templater::Spec::Helpers::InvokeMatcher
- Kernel
- String

No matching classes.

# Templater::Actions::Action

### Attributes

destination[RW]
generator[RW]
name[RW]
options[RW]
source[RW]

### Public Instance Methods

destination=(destination) click to toggle source

    # File lib/templater/actions/action.rb, line 13
    def destination=(destination)
      unless destination.blank?
        @destination = ::File.expand_path(convert_encoded_instructions(destination), generator.destination_root)
      end
    end

relative_destination() click to toggle source

Returns the destination path relative to Dir.pwd. This is useful for prettier output in interfaces where the destination root is Dir.pwd.

### Returns

String | The destination relative to Dir.pwd

    # File lib/templater/actions/action.rb, line 24
    def relative_destination
      @destination.relative_path_from(@generator.destination_root)
    end

source=(source) click to toggle source

    # File lib/templater/actions/action.rb, line 7
    def source=(source)
      unless source.blank?
        @source = ::File.expand_path(source, generator.source_root)
      end
    end

### Protected Instance Methods

callback(name) click to toggle source

    # File lib/templater/actions/action.rb, line 30
    def callback(name)
      @generator.send(@options[name], self) if @options[name]
    end

convert_encoded_instructions(filename) click to toggle source

    # File lib/templater/actions/action.rb, line 34
    def convert_encoded_instructions(filename)
      filename.gsub(/%.*?%/) do |string|
        instruction = string.match(/%(.*?)%/)[1]
        @generator.respond_to?(instruction) ? @generator.send(instruction) : string
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.