Class: RubyGPG2::StatusOutput

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lines) ⇒ StatusOutput

Returns a new instance of StatusOutput.



14
15
16
# File 'lib/ruby_gpg2/status_output.rb', line 14

def initialize(lines)
  @lines = lines
end

Class Method Details

.parse(lines) ⇒ Object



7
8
9
10
11
12
# File 'lib/ruby_gpg2/status_output.rb', line 7

def self.parse(lines)
  new(lines
      .strip
      .split("\n")
      .collect { |line| StatusLine.parse(line) })
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/ruby_gpg2/status_output.rb', line 26

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

#filter_by_type(type) ⇒ Object



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

def filter_by_type(type)
  StatusOutput.new(@lines.filter { |l| l.type == type })
end

#first_lineObject



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

def first_line
  @lines.first
end