Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/jinda/gen_class.rb
Overview
Add method to ruby class String ###############################
Instance Method Summary collapse
Instance Method Details
#comment? ⇒ Boolean
6 7 8 9 |
# File 'lib/jinda/gen_class.rb', line 6 def comment? self[0] == '#' # self[0]==35 # check if first char is # end |
#to_code ⇒ Object
11 12 13 14 |
# File 'lib/jinda/gen_class.rb', line 11 def to_code s = dup s.downcase.strip.tr(' ', '_').gsub(%r{[^#_/a-zA-Z0-9]}, '') end |