Module: CryptBufferConcern::Convertable
- Included in:
- CryptBuffer
- Defined in:
- lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb
Instance Method Summary collapse
- #base64(strict: true) ⇒ Object
- #bits ⇒ Object
- #chars ⇒ Object (also: #c)
- #hex ⇒ Object (also: #h)
- #str ⇒ Object (also: #s)
- #to_crypt_buffer ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#base64(strict: true) ⇒ Object
| 27 28 29 | # File 'lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb', line 27 def base64(strict: true) strict ? Base64.strict_encode64(str) : Base64.encode64(str) end | 
#bits ⇒ Object
| 19 20 21 | # File 'lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb', line 19 def bits map{|b| "%08d" % b.to_s(2) } end | 
#chars ⇒ Object Also known as: c
| 9 10 11 | # File 'lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb', line 9 def chars map(&:chr) end | 
#hex ⇒ Object Also known as: h
| 3 4 5 | # File 'lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb', line 3 def hex bytes2hex(bytes).upcase end | 
#str ⇒ Object Also known as: s
| 14 15 16 | # File 'lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb', line 14 def str map(&:chr).join end | 
#to_crypt_buffer ⇒ Object
| 31 32 33 | # File 'lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb', line 31 def to_crypt_buffer self end | 
#to_s ⇒ Object
| 23 24 25 | # File 'lib/crypto-toolbox/crypt_buffer/concerns/convertable.rb', line 23 def to_s str end |