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.



13
14
15
# File 'lib/ruby_gpg2/colon_output.rb', line 13

def initialize(records)
  @records = records
end

Class Method Details

.parse(records) ⇒ Object



6
7
8
9
10
11
# File 'lib/ruby_gpg2/colon_output.rb', line 6

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

Instance Method Details

#==(other) ⇒ Object



27
28
29
# File 'lib/ruby_gpg2/colon_output.rb', line 27

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

#public_keysObject



22
23
24
25
# File 'lib/ruby_gpg2/colon_output.rb', line 22

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

#secret_keysObject



17
18
19
20
# File 'lib/ruby_gpg2/colon_output.rb', line 17

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