Class: Symbol

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

Instance Method Summary collapse

Instance Method Details

#as(alias_name) ⇒ Object

call-seq: symbol.as(alias_name) -> a_symbol

Returns the symbol aliased (including ‘as’) as the aliased name

:book.as(:category)     #=> :"book as category"


16
17
18
# File 'lib/symbol.rb', line 16

def as(alias_name)
  "#{self} as #{alias_name}".to_sym
end

#to_sqlObject

call-seq: symbol.to_sql -> a_string

Returns a string with single quotes escaped.

"it's".to_sql     #=> "'it''s'"


7
8
9
# File 'lib/symbol.rb', line 7

def to_sql
  to_s
end