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)


5
6
7
8
# File 'lib/jinda/gen_class.rb', line 5

def comment?
  self[0]=='#'
  # self[0]==35 # check if first char is #
end

#to_codeObject

self==35 # check if first char is #



9
10
11
12
# File 'lib/jinda/gen_class.rb', line 9

def to_code
  s= self.dup
  s.downcase.strip.gsub(' ','_').gsub(/[^#_\/a-zA-Z0-9]/,'')
end