Hyphens #3

keilmillerjr opened this Issue Oct 11, 2012 · 1 comment


None yet
2 participants

keilmillerjr commented Oct 11, 2012


awesome_icon(:ok)  # Does work
awesome_icon(:bookmark-empty)  # Does NOT work
awesome_icon('bookmark-empty')  # Does work
awesome_icon(:'bookmark-empty')  # Does work, my prefered syntax

Ruby 1.9 hash with a dash in a key

There are some legitimate symbols that cannot be used with the new syntax. I cannot find a reference, but it appears that a symbol name matching /[a-zA-Z_][a-zA-Z_0-9]*/ is allowed with the new syntax. If the symbol name contains special characters such as '-', you have to use the Ruby 1.8 syntax, :'my-symbol-name'

I am going to file this as a closed issue for others to see, and submit a push request to update the readme with an example using my "preferred syntax". I think this would help others who might be using the gem, but not exactly fluent enough in Ruby to realize that ruby doesn't like hyphens there.


kristianmandrup commented Oct 12, 2012

Yeah, this is a standard ruby syntax issue... ;)
I usually do :"bookmark-empty". If all the icons use the dash "-" convention, we could have the helper method auto convert any "_" to "-" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment