Class: String
- Inherits:
-
Object
show all
- Defined in:
- lib/adhearsion/foundation/string.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
112
113
114
|
# File 'lib/adhearsion/voip/dsl/numerical_string.rb', line 112
def ===(arg)
arg.respond_to?(:__real_string) || original_threequal(arg)
end
|
.random(length_of_string = 8) ⇒ Object
19
20
21
|
# File 'lib/adhearsion/foundation/string.rb', line 19
def self.random(length_of_string=8)
Array.new(length_of_string) { random_char }.join
end
|
.random_char ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/adhearsion/foundation/string.rb', line 11
def self.random_char
case random_digit = rand(62)
when 0...10 then random_digit.to_s
when 10...36 then (random_digit + 55).chr
when 36...62 then (random_digit + 61).chr
end
end
|
Instance Method Details
23
|
# File 'lib/adhearsion/foundation/string.rb', line 23
def nameify() downcase.gsub(/[^\w]/, '') end
|
24
|
# File 'lib/adhearsion/foundation/string.rb', line 24
def nameify!() replace nameify end
|
3
4
5
|
# File 'lib/adhearsion/foundation/string.rb', line 3
def unindent
gsub(/^\s*/,'')
end
|
#unindent! ⇒ Object
7
8
9
|
# File 'lib/adhearsion/foundation/string.rb', line 7
def unindent!
gsub!(/^\s*/,'')
end
|