summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorFederico Bana <me@banafederico.com>2013-03-25 16:58:19 -0300
committerpushmatrix <daniel.beauchamp@gmail.com>2013-05-09 20:54:20 +0200
commit31bdc6da2706eec95c54ca46cb8e544661296bf6 (patch)
tree9fbf355aa46ab084d649d918a69cd0bef4728e23 /bin
parentaadfbf1027faeb724e81eecb1a9495b908864b1a (diff)
Properly hyphenate css class names for widgets.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dashing7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/dashing b/bin/dashing
index 4fb4b50..8c7e348 100755
--- a/bin/dashing
+++ b/bin/dashing
@@ -28,6 +28,11 @@ module Dashing
class << self
attr_accessor :auth_token
+
+ def hyphenate(str)
+ return str.downcase if str =~ /^[A-Z-]+$/
+ str.gsub('_', '-').gsub(/\B[A-Z]/, '-\&').squeeze('-').downcase
+ end
end
attr_accessor :name
@@ -106,4 +111,4 @@ module Dashing
end
end
-Dashing::CLI.start \ No newline at end of file
+Dashing::CLI.start