Module: HighFive::Thor::Task::ClassMethods

Defined in:
lib/high_five/thor/task.rb

Instance Method Summary collapse

Instance Method Details

#namespace(name = nil) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/high_five/thor/task.rb', line 40

def namespace(name=nil)
  case name
  when nil
    constant = self.to_s.gsub(/^Thor::Sandbox::/, "")
    strip = $high_five_runner ? /^HighFive::Thor::Tasks::/ : /(?<=HighFive::)Thor::Tasks::/
    constant = constant.gsub(strip, "")
    constant =  ::Thor::Util.snake_case(constant).squeeze(":")
    @namespace ||= constant
  else
    super
  end
end