Module: TSMAccounting
- Defined in:
- lib/tsm-accounting.rb
Defined Under Namespace
Classes: Database, Item, Transaction
Constant Summary collapse
- VERSION =
'1.1.0'
Class Method Summary collapse
-
.decode(value) ⇒ Object
Transaction.
Class Method Details
.decode(value) ⇒ Object
Transaction
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/tsm-accounting.rb', line 273 def self.decode(value) alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_=" base = alpha.length i = value.length - 1 result = 0 value.each_char do |w| if w.match(/([A-Za-z0-9_=])/) result += (alpha.index(w)) * (base**i) i -= 1 end end return result end |