Module: Arcade::Support::String2
- Defined in:
- lib/arcade/support/conversions.rb
Instance Method Summary collapse
-
#from_db ⇒ Object
(also: #expand)
from db translates the database response into active-orient objects.
-
#to_db ⇒ Object
if the string contains “#xx:yy” omit quotes.
- #to_or ⇒ Object
Instance Method Details
#from_db ⇒ Object Also known as: expand
from db translates the database response into active-orient objects
symbols are representated via “:something]:”
database records respond to the “rid”-method
other values are not modified
247 248 249 250 251 252 253 254 255 256 |
# File 'lib/arcade/support/conversions.rb', line 247 def from_db if rid? Arcade::Init.db.get self elsif self =~ /^:.*:$/ # symbol-representation in the database self[1..-2].to_sym else self end end |
#to_db ⇒ Object
if the string contains “#xx:yy” omit quotes
260 261 262 |
# File 'lib/arcade/support/conversions.rb', line 260 def to_db rid? ? "#"+rid : self # return the string (not the quoted string. this is to_or) end |
#to_or ⇒ Object
264 265 266 |
# File 'lib/arcade/support/conversions.rb', line 264 def to_or quote end |