Skip to content

Commit

Permalink
Shorten the Guard plugin string representation.
Browse files Browse the repository at this point in the history
  • Loading branch information
netzpirat committed Dec 19, 2012
1 parent 864e13c commit 7b512e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions lib/guard/guard.rb
Expand Up @@ -60,13 +60,13 @@ def initialize(watchers = [], options = {})

# Specify the source for the Guardfile template.
# Each Guard plugin can redefine this method to add its own logic.
#
#
# @param [String] The plugin name
#
#
def self.template(name)
File.read("#{ ::Guard.locate_guard(name) }/lib/guard/#{ name }/templates/Guardfile")
end

# Initialize the Guard plugin. This will copy the Guardfile template inside the Guard plugin gem.
# The template Guardfile must be located within the Gem at `lib/guard/guard-name/templates/Guardfile`.
#
Expand Down Expand Up @@ -152,12 +152,13 @@ def self.init(name)
# @!method run_on_removals(paths)

# Convert plugin to string representation. The
# default just uses the plugin class name.
#
# default just uses the plugin class name and
# removes the Guard module name.
#
# @return [String] the string representation
#
def to_s
self.class.to_s
self.class.to_s.downcase.sub('guard::', '')
end

end
Expand Down
4 changes: 2 additions & 2 deletions spec/guard/guard_spec.rb
Expand Up @@ -61,9 +61,9 @@
describe '#to_s' do
before(:all) { class Guard::Dummy < Guard::Guard; end }

it "output Guard properly" do
it "output the short plugin name" do
guard = Guard::Dummy.new
guard.to_s.should eq "Guard::Dummy"
guard.to_s.should eq "dummy"
end
end

Expand Down

0 comments on commit 7b512e5

Please sign in to comment.