diff --git a/lib/thor.rb b/lib/thor.rb index 5c19d0d62..a85d0c9ba 100644 --- a/lib/thor.rb +++ b/lib/thor.rb @@ -9,14 +9,14 @@ class << self # meth:: name of the default task # def default_task(meth=nil) - case meth - when :none - @default_task = 'help' - when nil - @default_task ||= from_superclass(:default_task, 'help') - else - @default_task = meth.to_s - end + @default_task = case meth + when :none + 'help' + when nil + @default_task || from_superclass(:default_task, 'help') + else + meth.to_s + end end # Registers another Thor subclass as a command. diff --git a/lib/thor/base.rb b/lib/thor/base.rb index d599a7544..8772d5f27 100644 --- a/lib/thor/base.rb +++ b/lib/thor/base.rb @@ -313,12 +313,12 @@ def remove_class_option(*names) # name # def group(name=nil) - case name - when nil - @group ||= from_superclass(:group, 'standard') - else - @group = name.to_s - end + @group = case name + when nil + @group || from_superclass(:group, 'standard') + else + name.to_s + end end # Returns the tasks for this Thor class. @@ -413,12 +413,12 @@ def no_tasks # thor :my_task # def namespace(name=nil) - case name - when nil - @namespace ||= Thor::Util.namespace_from_thor_class(self) - else - @namespace = name.to_s - end + @namespace = case name + when nil + @namespace || Thor::Util.namespace_from_thor_class(self) + else + @namespace = name.to_s + end end # Parses the task and options from the given args, instantiate the class diff --git a/lib/thor/group.rb b/lib/thor/group.rb index 874ac47a1..91eaa7335 100644 --- a/lib/thor/group.rb +++ b/lib/thor/group.rb @@ -14,12 +14,12 @@ class << self # description:: The description for this Thor::Group. # def desc(description=nil) - case description - when nil - @desc ||= from_superclass(:desc, nil) - else - @desc = description - end + @desc = case description + when nil + @desc || from_superclass(:desc, nil) + else + description + end end # Prints help information.