Class: ICU4X::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/icu4x/rake_task.rb

Overview

Rake task for generating ICU4X data blobs.

Examples:

Basic usage

require "icu4x/rake_task"

ICU4X::RakeTask.new do |t|
  t.output = "data/icu4x.postcard"
end

Custom task name and locales

ICU4X::RakeTask.new("myapp:generate_data") do |t|
  t.locales = %w[en ja de]
  t.output = "data/icu4x.postcard"
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "icu4x:data:generate") {|self| ... } ⇒ RakeTask

Creates a new RakeTask.

Parameters:

  • name (String) (defaults to: "icu4x:data:generate")

    Task name (default: “icu4x:data:generate”)

Yields:

  • (self)

    Configuration block

Yield Parameters:

  • task (RakeTask)

    The task instance for configuration

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/icu4x/rake_task.rb', line 42

def initialize(name="icu4x:data:generate")
  super()
  @name = name
  @locales = :recommended
  @markers = :all
  @output = nil

  yield self if block_given?

  raise ArgumentError, "output is required" if @output.nil?

  define_tasks
end

Instance Attribute Details

#localesSymbol, Array<String>

Returns Locale specifier or array of locale strings Defaults to ‘:recommended`.

Returns:

  • (Symbol, Array<String>)

    Locale specifier or array of locale strings Defaults to ‘:recommended`



28
29
30
# File 'lib/icu4x/rake_task.rb', line 28

def locales
  @locales
end

#markersSymbol, Array<String>

Returns Data markers to include Defaults to ‘:all`.

Returns:

  • (Symbol, Array<String>)

    Data markers to include Defaults to ‘:all`



32
33
34
# File 'lib/icu4x/rake_task.rb', line 32

def markers
  @markers
end

#nameString (readonly)

Returns The name of the task.

Returns:

  • (String)

    The name of the task



24
25
26
# File 'lib/icu4x/rake_task.rb', line 24

def name
  @name
end

#outputPathname, String

Returns Output path relative to Rakefile.

Returns:

  • (Pathname, String)

    Output path relative to Rakefile



35
36
37
# File 'lib/icu4x/rake_task.rb', line 35

def output
  @output
end