Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/scrappy/support.rb
Instance Method Summary collapse
Instance Method Details
#underscore ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/scrappy/support.rb', line 25 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |
#wikify ⇒ Object
22 23 24 |
# File 'lib/scrappy/support.rb', line 22 def wikify gsub(/^[a-z]|\s+[a-z]/) { |a| a.upcase }.gsub(/\s/, '') end |