Class: Capricorn::Util

Inherits:
Thor show all
Defined in:
lib/capricorn-util.rb

Direct Known Subclasses

Internal

Defined Under Namespace

Classes: Internal

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/capricorn-util.rb', line 23

def method_missing(meth, *args)
  if self.class == Capricorn::Util
    meth = meth.to_s
    klass, task = Thor::Util.find_class_and_task_by_namespace(meth)
    args.unshift(task) if task
    klass.start(args, :shell => self.shell)
  else
    super
  end
end

Class Method Details



10
11
12
# File 'lib/capricorn-util.rb', line 10

def self.banner(task)
  "#{banner_base} #{task.formatted_usage(self, true)}"
end

Instance Method Details

#help(meth = nil) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/capricorn-util.rb', line 14

def help(meth=nil)
  if meth && !self.respond_to?(meth)
    klass, task = Thor::Util.find_class_and_task_by_namespace(meth)
    klass.start(["-h", task].compact, :shell => self.shell)
  else
    super
  end
end