Class: String
Overview
String helpers
Instance Method Summary collapse
- #/(other) ⇒ Object
- #camel_case ⇒ Object
- #decode64 ⇒ Object
- #encode64 ⇒ Object
- #md5sum ⇒ Object
- #sha1sum ⇒ Object
- #snake_case ⇒ Object
- #strict_decode64 ⇒ Object
- #strict_encode64 ⇒ Object
- #to_dynamodb ⇒ Object
- #to_h_from_form ⇒ Object
- #to_h_from_json ⇒ Object
- #utc ⇒ Object
Instance Method Details
#/(other) ⇒ Object
6 |
# File 'lib/yake/support/string.rb', line 6 def /(other) = File.join(self, other.to_s) |
#camel_case ⇒ Object
7 |
# File 'lib/yake/support/string.rb', line 7 def camel_case = split(/[_ ]/).map(&:capitalize).join |
#decode64 ⇒ Object
8 |
# File 'lib/yake/support/string.rb', line 8 def decode64 = unpack1('m') |
#encode64 ⇒ Object
9 |
# File 'lib/yake/support/string.rb', line 9 def encode64 = [self].pack('m') |
#md5sum ⇒ Object
10 |
# File 'lib/yake/support/string.rb', line 10 def md5sum = Digest::MD5.hexdigest(self) |
#sha1sum ⇒ Object
11 |
# File 'lib/yake/support/string.rb', line 11 def sha1sum = Digest::SHA1.hexdigest(self) |
#snake_case ⇒ Object
12 |
# File 'lib/yake/support/string.rb', line 12 def snake_case = gsub(/([a-z])([A-Z])/, '\1_\2').gsub(/ /, '_').downcase |
#strict_decode64 ⇒ Object
13 |
# File 'lib/yake/support/string.rb', line 13 def strict_decode64 = unpack1('m0') |
#strict_encode64 ⇒ Object
14 |
# File 'lib/yake/support/string.rb', line 14 def strict_encode64 = [self].pack('m0') |
#to_dynamodb ⇒ Object
15 |
# File 'lib/yake/support/string.rb', line 15 def to_dynamodb = { S: self } |
#to_h_from_form ⇒ Object
17 |
# File 'lib/yake/support/string.rb', line 17 def to_h_from_form = URI.decode_www_form(self).to_h |
#to_h_from_json ⇒ Object
16 |
# File 'lib/yake/support/string.rb', line 16 def to_h_from_json(...) = JSON.parse(self, ...) |