Class: Symbol

Inherits:
Object show all
Defined in:
lib/hash-utils/symbol.rb

Overview

Symbol extension.

Instance Method Summary collapse

Instance Method Details

#*(multi) ⇒ Object



21
22
23
# File 'lib/hash-utils/symbol.rb', line 21

def *(multi)
    (self.to_s * multi).to_sym 
end

#+(other_str) ⇒ Object Also known as: concat



36
37
38
# File 'lib/hash-utils/symbol.rb', line 36

def +(other_str)
    (self.to_s + other_str.to_s).to_sym
end

#[](*args) ⇒ Object Also known as: slice



54
55
56
# File 'lib/hash-utils/symbol.rb', line 54

def [](*args)
    self.to_s[*args]
end

#append(string) ⇒ Object



101
102
103
# File 'lib/hash-utils/symbol.rb', line 101

def append(string)
    (self.to_s << string.to_s).to_sym
end

#end_with?(*suffix) ⇒ Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/hash-utils/symbol.rb', line 87

def end_with?(*suffix)
    self.to_s.end_with?(*suffix)
end

#prepend(string) ⇒ Object



115
116
117
# File 'lib/hash-utils/symbol.rb', line 115

def prepend(string)
    (string.to_s + self.to_s).to_sym
end

#split(separator = " ", count = 0) ⇒ Object



129
130
131
132
133
# File 'lib/hash-utils/symbol.rb', line 129

def split(separator = " ", count = 0)
    self.to_s.split(separator, count).map! do |i|
        i.to_sym
    end
end

#start_with?(*prefix) ⇒ Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/hash-utils/symbol.rb', line 73

def start_with?(*prefix)
    self.to_s.start_with?(*prefix)
end

#stripObject



146
147
148
# File 'lib/hash-utils/symbol.rb', line 146

def strip
    self.to_s.strip!.to_sym
end