Skip to content

Commit

Permalink
Adds documentation for Resource#slug method
Browse files Browse the repository at this point in the history
  • Loading branch information
elthariel committed Oct 8, 2013
1 parent df34b5f commit d967454
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/calamum/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def initialize(attrs)
@tryit = attrs['tryit']
end

# Returns a unique, but readable name for this resource suitable for use as a filename
#
# @return [String] resource filename
def slug
sanitized_uri = uri.gsub(/[^\w]/, '_').gsub('__', '_')

"#{sanitized_uri}_#{action.downcase}_#{self.object_id}"
end

Expand Down

0 comments on commit d967454

Please sign in to comment.