Class: MooTool::Models::RemoteResponse
- Inherits:
-
Object
- Object
- MooTool::Models::RemoteResponse
- Defined in:
- lib/mootool/models/remote_response.rb
Constant Summary collapse
- MATCHER_REGEX =
/---------RESPONSE START---------.*BODY:(?<body>.*)----------RESPONSE END----------/m
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.load(file) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mootool/models/remote_response.rb', line 8 def self.load(file) raw_data = File.read(file) body = raw_data.match(MATCHER_REGEX).named_captures['body'] @result = case body when /-----BEGIN CERTIFICATE-----/ body.scan(/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m).map do |text| ::MooTool::Models::Certificate.new OpenSSL::X509::Certificate.new(text) end end end |
Instance Method Details
#inspect ⇒ Object
25 26 27 |
# File 'lib/mootool/models/remote_response.rb', line 25 def inspect to_h.ai end |
#to_h ⇒ Object
21 22 23 |
# File 'lib/mootool/models/remote_response.rb', line 21 def to_h { result: @result } end |