Class: Symbol
Instance Method Summary collapse
-
#keyword ⇒ Object
Returns a symbol with the same name prefixed by a colon.
-
#to_lisp ⇒ Object
Returns a string that represents the symbol as a lisp symbol.
Instance Method Details
#keyword ⇒ Object
Returns a symbol with the same name prefixed by a colon. This is convenient when converting a symbol with the #to_lisp method.
Example:
:foo_bar.keyword.to_lisp => ':foo-bar'
40 41 42 43 44 45 46 |
# File 'lib/spectator/emacs.rb', line 40 def keyword if self[0] == ':' self else ":#{to_s}".to_sym end end |
#to_lisp ⇒ Object
Returns a string that represents the symbol as a lisp symbol. Underscores are converted to dashes.
Example:
:foo_bar.to_lisp => 'foo-bar'
28 29 30 |
# File 'lib/spectator/emacs.rb', line 28 def to_lisp to_s.gsub "_", "-" end |