Class: Symbol

Inherits:
Object show all
Defined in:
lib/rubyhacks.rb

Instance Method Summary collapse

Instance Method Details

#+(other) ⇒ Object



103
104
105
106
107
108
109
110
111
# File 'lib/rubyhacks.rb', line 103

def +(other)
	if other.class == String
		self.to_s + other
	elsif other.class == Symbol
		(self.to_s+other.to_s).to_sym
	else
		raise NoMethodError
	end
end

#-@Object



120
121
122
123
124
# File 'lib/rubyhacks.rb', line 120

def -@
    @sign ||= 1
    @sign *= -1
    self
end

#=~(other) ⇒ Object



113
114
115
# File 'lib/rubyhacks.rb', line 113

def =~(other)
	return self.to_s =~ other
end

#signObject



116
117
118
119
# File 'lib/rubyhacks.rb', line 116

def sign
	@sign ||= 1
	@sign
end