Class: RubyGPG2::ColonOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_gpg2/colon_output.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(records) ⇒ ColonOutput

Returns a new instance of ColonOutput.



15
16
17
# File 'lib/ruby_gpg2/colon_output.rb', line 15

def initialize(records)
  @records = records
end

Class Method Details

.parse(records) ⇒ Object



8
9
10
11
12
13
# File 'lib/ruby_gpg2/colon_output.rb', line 8

def self.parse(records)
  new(records
        .strip
        .split("\n")
        .collect { |record| ColonRecord.parse(record) })
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
# File 'lib/ruby_gpg2/colon_output.rb', line 29

def ==(other)
  other.class == self.class && other.state == state
end

#public_keysObject



24
25
26
27
# File 'lib/ruby_gpg2/colon_output.rb', line 24

def public_keys
  group_by_type(:public_key)
    .map { |record_group| extract_key(:public, record_group) }
end

#secret_keysObject



19
20
21
22
# File 'lib/ruby_gpg2/colon_output.rb', line 19

def secret_keys
  group_by_type(:secret_key)
    .map { |record_group| extract_key(:secret, record_group) }
end