Method: Arrow::HTMLToken#css_class
- Defined in:
- lib/arrow/htmltokenizer.rb
#css_class ⇒ Object
Return the HTML element class attribute that corresponds to this node.
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/arrow/htmltokenizer.rb', line 131 def css_class tokenclass = self.class.name. sub( /Arrow::(HTML)?/i, ''). gsub( /::/, '-' ). gsub( /([a-z])([A-Z])/, "\\1-\\2" ). gsub( /[^-\w]+/, '' ). downcase tokenclass << "-token" unless /-token$/.match( tokenclass ) return tokenclass end |