Class: Chloe::Task

Inherits:
Thor
  • Object
show all
Defined in:
lib/chloe/task.rb

Class Method Summary collapse

Class Method Details

.inherited(subclass) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/chloe/task.rb', line 4

def self.inherited(subclass)
  parts      = subclass.to_s.split('::')
  basename   = parts.last
  namespace  = parts[0..-2]
  snakename  = Thor::Util.snake_case(basename)
  executable = (namespace << 'Executable').join('::').constantize

  executable.tag_for_registry subclass, snakename.to_sym, snakename
end

.summary(summary = nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/chloe/task.rb', line 14

def self.summary(summary = nil)
  if summary
    @summary = summary
  else
    @summary || self.to_s.split('::').last
  end
end