Module: RakeFactory::Defaults

Includes:
Parameters
Included in:
Task
Defined in:
lib/rake_factory/defaults.rb

Instance Method Summary collapse

Methods included from Parameters

#parameter, #parameter_set

Instance Method Details

#default_argument_names(argument_names) ⇒ Object



38
39
40
# File 'lib/rake_factory/defaults.rb', line 38

def default_argument_names(argument_names)
  parameter_set.update_default_for(:argument_names, argument_names)
end

#default_description(description) ⇒ Object



52
53
54
# File 'lib/rake_factory/defaults.rb', line 52

def default_description(description)
  parameter_set.update_default_for(:description, description)
end

#default_name(name) ⇒ Object



34
35
36
# File 'lib/rake_factory/defaults.rb', line 34

def default_name(name)
  parameter_set.update_default_for(:name, name)
end

#default_order_only_prerequisites(order_only_prerequisites) ⇒ Object



46
47
48
49
50
# File 'lib/rake_factory/defaults.rb', line 46

def default_order_only_prerequisites(order_only_prerequisites)
  parameter_set
      .update_default_for(
          :order_only_prerequisites, order_only_prerequisites)
end

#default_prerequisites(prerequisites) ⇒ Object



42
43
44
# File 'lib/rake_factory/defaults.rb', line 42

def default_prerequisites(prerequisites)
  parameter_set.update_default_for(:prerequisites, prerequisites)
end

#inherited(inheritor) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rake_factory/defaults.rb', line 10

def inherited(inheritor)
  super(inheritor)
  inheritor.class_eval do
    parameter(:name,
        configurable: false,
        transform: lambda { |n| n.to_sym })
    parameter(:argument_names,
        configurable: false,
        default: [])
    parameter(:prerequisites,
        configurable: false,
        default: [])
    parameter(:order_only_prerequisites,
        configurable: false,
        default: [])
    parameter(:description,
        configurable: false)

    unless inheritor.name.nil?
      default_name inheritor.name.demodulize.underscore
    end
  end
end