Class: RubeePass::AttachmentDecoder
- Inherits:
-
Object
- Object
- RubeePass::AttachmentDecoder
- Defined in:
- lib/rubeepass/attachment_decoder.rb
Instance Method Summary collapse
- #get_attachment(ref) ⇒ Object
-
#initialize(binaries) ⇒ AttachmentDecoder
constructor
A new instance of AttachmentDecoder.
Constructor Details
#initialize(binaries) ⇒ AttachmentDecoder
Returns a new instance of AttachmentDecoder.
21 22 23 |
# File 'lib/rubeepass/attachment_decoder.rb', line 21 def initialize(binaries) @binaries = binaries end |
Instance Method Details
#get_attachment(ref) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rubeepass/attachment_decoder.rb', line 6 def (ref) @binaries.elements.each("Binary") do |elem| if (elem.attributes["ID"] == ref) if (elem.attributes["Compressed"].nil?) begin return Base64.decode64(elem.text) rescue return elem.text end end return parse_gzip(elem.text) end end end |