Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/string.rb

Instance Method Summary collapse

Instance Method Details

#camel_case_lowerObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ext/string.rb', line 6

def camel_case_lower
  @class_to_array = self.split('')
  @class_name_length = @class_to_array.length - 1
  @output = @class_to_array.each_with_index do |letter,i|
    if i ==0
      letter.downcase!
    elsif i == @class_name_length
      letter.gsub!(/y/,'ie')
    end
  end.join

  @output + 's'
end

#is_i?Boolean



2
3
4
# File 'lib/ext/string.rb', line 2

def is_i?
   /\A[-+]?\d+\z/ === self
end