Class: Dev::Template::BaseInterface

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/firespring_dev_commands/templates/base_interface.rb

Overview

Base interface template takes a custom arg for the initializer and requires the user to implement the create_tasks! method

Direct Known Subclasses

ApplicationInterface, Aws, Aws::Ci, Docker::Default, Eol, Git

Instance Method Summary collapse

Constructor Details

#initialize(exclude: []) ⇒ BaseInterface

Returns a new instance of BaseInterface.



10
11
12
13
# File 'lib/firespring_dev_commands/templates/base_interface.rb', line 10

def initialize(exclude: [])
  @exclude = Array(exclude).map(&:to_sym)
  create_tasks!
end

Instance Method Details

#create_tasks! ⇒ Object

This method executes all instance methods which match "create_.*_task!" This way a user can easily add new methods to the default template simply by defining new create methods on the class which follow the naming convention



18
19
20
21
22
23
24
# File 'lib/firespring_dev_commands/templates/base_interface.rb', line 18

def create_tasks!
  self.class.instance_methods(false).sort.each do |method|
    next unless /create_.*_task!/.match?(method)

    send(method)
  end
end