Class: CharSize::Rake::GeneratorTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/char_size/rake/generator_task.rb

Overview

A Rake task to generate a static copy of the CharSize module. This means that the char_size gem can be used as a development dependency rather than a runtime dependency.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :char_size) {|self| ... } ⇒ GeneratorTask

Defines a new CharSize module generator task.

Parameters:

  • name (String, Symbol) (defaults to: :char_size)

    the name of the task

Yields:

  • (self)

    allowing any options to be modified on the task



24
25
26
27
28
29
30
31
# File 'lib/char_size/rake/generator_task.rb', line 24

def initialize(name = :char_size)
  @name = name
  @destination = "lib/char_size.rb"

  yield self if block_given?

  define
end

Instance Attribute Details

#destinationString

The path of the generated file. Defaults to “lib/char_size.rb”.

Returns:

  • (String)

    the file path



19
20
21
# File 'lib/char_size/rake/generator_task.rb', line 19

def destination
  @destination
end

#nameString, Symbol

The name of the task. Defaults to :char_size.

Returns:

  • (String, Symbol)

    the task name



15
16
17
# File 'lib/char_size/rake/generator_task.rb', line 15

def name
  @name
end