Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/eth/signature.rb
Instance Method Summary collapse
Instance Method Details
#from_urlsafe_base64 ⇒ Object
11 12 13 |
# File 'lib/eth/signature.rb', line 11 def from_urlsafe_base64 Base64.urlsafe_decode64(self) end |
#is_hex? ⇒ Boolean
23 24 25 |
# File 'lib/eth/signature.rb', line 23 def is_hex? !self.gsub("0x", '')[/\H/] end |
#to_hex ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/eth/signature.rb', line 15 def to_hex if self.is_hex? return self else Eth::Utils.bin_to_prefixed_hex(self) end end |
#to_urlsafe_base64 ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/eth/signature.rb', line 3 def to_urlsafe_base64 if is_hex? Base64.urlsafe_encode64(Eth::Utils.hex_to_bin(self)) else Base64.urlsafe_encode64(self) end end |