Class: SamlTool::Encoder

Inherits:
Object
  • Object
show all
Defined in:
lib/saml_tool/encoder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(saml) ⇒ Encoder



11
12
13
14
# File 'lib/saml_tool/encoder.rb', line 11

def initialize(saml)
  @saml = saml
  @output = @saml.clone
end

Instance Attribute Details

#outputObject

Returns the value of attribute output.



5
6
7
# File 'lib/saml_tool/encoder.rb', line 5

def output
  @output
end

#samlObject (readonly)

Returns the value of attribute saml.



4
5
6
# File 'lib/saml_tool/encoder.rb', line 4

def saml
  @saml
end

Class Method Details

.encode(saml) ⇒ Object



7
8
9
# File 'lib/saml_tool/encoder.rb', line 7

def self.encode(saml)
  new(saml).encode
end

Instance Method Details

#base64Object



22
23
24
# File 'lib/saml_tool/encoder.rb', line 22

def base64
  self.output = Base64.encode64 output
end

#encodeObject



16
17
18
19
20
# File 'lib/saml_tool/encoder.rb', line 16

def encode
  zlib
  base64
  output
end

#zlibObject



26
27
28
# File 'lib/saml_tool/encoder.rb', line 26

def zlib
  self.output = Zlib::Deflate.deflate(output, Zlib::BEST_COMPRESSION)[2..-5]
end