Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/jinda/gen_class.rb

Overview

Add method to ruby class String ###############################

Instance Method Summary collapse

Instance Method Details

#comment?Boolean

Returns:

  • (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_codeObject



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