Class: Symbol

Inherits:
Object show all
Defined in:
lib/kyanite/fsymbol.rb,
lib/kyanite/symbol.rb,
lib/kyanite/general/classutils.rb

Overview

Class Utils

Kyanite definitions

Class, Symbol, String

Kyanite tests and examples

TestKyaniteClassutils

Usage

require ‘kyanite/general/classutils’

Core Extensions collapse

Class Utils collapse

Instance Method Summary collapse

Instance Method Details

#*(n) ⇒ Array

like String method with same name

Returns:



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

Returns:



24
25
26
# File 'lib/kyanite/symbol.rb', line 24

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

#dupself

self, you can not dup Symbols

Returns:

  • (self)


20
# File 'lib/kyanite/symbol.rb', line 20

def dup;                            self;            end

#to_classClass

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.

Returns:



194
195
196
# File 'lib/kyanite/general/classutils.rb', line 194

def to_class 
    self.to_s.to_class
end

#to_classnameString

Converts to a class name , the reverse of to_class.

classes Class, Symbol, String. The class name will contain only lowercase letters.

'MyModul::MyClass'  =>  'my_class'

Tests and examples here.

Returns:



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