Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/model.rb,
lib/support.rb

Instance Method Summary collapse

Instance Method Details

#from_orientObject Also known as: reload!



16
17
18
19
20
21
22
# File 'lib/support.rb', line 16

def from_orient
  if rid? 
    ActiveOrient::Model.autoload_object  self
  else
    self
  end
end

#rid?Boolean



13
14
15
# File 'lib/support.rb', line 13

def rid? 
  self =~  /\A[#]{,1}[0-9]{1,}:[0-9]{1,}\z/   
end

#to_classnameObject



2
3
4
5
6
7
8
# File 'lib/support.rb', line 2

def to_classname
  if self[0] =='$'
    self[1..-1]
  else
    self.camelize 
  end
end

#to_orObject



2
3
4
# File 'lib/model.rb', line 2

def to_or
  "'#{self}'"
end

#to_orientObject



9
10
11
12
# File 'lib/support.rb', line 9

def to_orient
  self.gsub /%/, '(percent)'

end