Class: String

Inherits:
Object show all
Defined in:
lib/yake/support/string.rb

Overview

String helpers

Instance Method Summary collapse

Instance Method Details

#/(other) ⇒ Object



6
# File 'lib/yake/support/string.rb', line 6

def /(other) = File.join(self, other.to_s)

#camel_caseObject



7
# File 'lib/yake/support/string.rb', line 7

def camel_case          = split(/[_ ]/).map(&:capitalize).join

#decode64Object



8
# File 'lib/yake/support/string.rb', line 8

def decode64            = unpack1('m')

#encode64Object



9
# File 'lib/yake/support/string.rb', line 9

def encode64            = [self].pack('m')

#md5sumObject



10
# File 'lib/yake/support/string.rb', line 10

def md5sum              = Digest::MD5.hexdigest(self)

#sha1sumObject



11
# File 'lib/yake/support/string.rb', line 11

def sha1sum             = Digest::SHA1.hexdigest(self)

#snake_caseObject



12
# File 'lib/yake/support/string.rb', line 12

def snake_case          = gsub(/([a-z])([A-Z])/, '\1_\2').gsub(/ /, '_').downcase

#strict_decode64Object



13
# File 'lib/yake/support/string.rb', line 13

def strict_decode64     = unpack1('m0')

#strict_encode64Object



14
# File 'lib/yake/support/string.rb', line 14

def strict_encode64     = [self].pack('m0')

#to_dynamodbObject



15
# File 'lib/yake/support/string.rb', line 15

def to_dynamodb         = { S: self }

#to_h_from_formObject



17
# File 'lib/yake/support/string.rb', line 17

def to_h_from_form      = URI.decode_www_form(self).to_h

#to_h_from_jsonObject



16
# File 'lib/yake/support/string.rb', line 16

def to_h_from_json(...) = JSON.parse(self, ...)

#utcObject



18
# File 'lib/yake/support/string.rb', line 18

def utc                 = UTC.parse(self)