Class: Symbol
- Defined in:
- lib/kyanite/fsymbol.rb,
lib/kyanite/symbol.rb,
lib/kyanite/general/classutils.rb
Overview
Core Extensions collapse
-
#*(n) ⇒ Array
like String method with same name.
-
#+(other) ⇒ Symbol
like String method with same name.
-
#dup ⇒ self
self, you can not dup Symbols.
Class Utils collapse
-
#to_class ⇒ Class
Converts to a class, the reverse of to_classname.
-
#to_classname ⇒ String
Converts to a class name , the reverse of to_class.
Instance Method Summary collapse
Instance Method Details
#*(n) ⇒ Array
like String method with same name
30 31 32 33 34 35 36 |
# File 'lib/kyanite/symbol.rb', line 30 def *(n) result = [] n.times do result << self end # do return result end |
#+(other) ⇒ Symbol
like String method with same name
24 25 26 |
# File 'lib/kyanite/symbol.rb', line 24 def +(other) (self.to_s + other.to_s).to_sym end |
#dup ⇒ self
self, you can not dup Symbols
20 |
# File 'lib/kyanite/symbol.rb', line 20 def dup; self; end |
#to_class ⇒ Class
Converts to a class, the reverse of to_classname
Defined for classes Class, Symbol, String. Accepts both CamelCase and down_case.
Tests and examples here.
194 195 196 |
# File 'lib/kyanite/general/classutils.rb', line 194 def to_class self.to_s.to_class end |
#to_classname ⇒ String
189 190 191 |
# File 'lib/kyanite/general/classutils.rb', line 189 def to_classname self.to_s.to_classname end |
#to_fsymbol(def_tree = nil) ⇒ Object
119 120 121 |
# File 'lib/kyanite/fsymbol.rb', line 119 def to_fsymbol(def_tree=nil) FSymbol.new(self, def_tree) end |