Class: RubyGPG2::StatusLines::Imported

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Imported

Returns a new instance of Imported.



17
18
19
20
21
# File 'lib/ruby_gpg2/status_lines/imported.rb', line 17

def initialize(opts)
  @raw = opts[:raw]
  @key_id = opts[:key_id]
  @user_id = opts[:user_id]
end

Instance Attribute Details

#key_idObject (readonly)

Returns the value of attribute key_id.



12
13
14
# File 'lib/ruby_gpg2/status_lines/imported.rb', line 12

def key_id
  @key_id
end

#rawObject (readonly)

Returns the value of attribute raw.



12
13
14
# File 'lib/ruby_gpg2/status_lines/imported.rb', line 12

def raw
  @raw
end

#user_idObject (readonly)

Returns the value of attribute user_id.



12
13
14
# File 'lib/ruby_gpg2/status_lines/imported.rb', line 12

def user_id
  @user_id
end

Class Method Details

.parse(line) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/ruby_gpg2/status_lines/imported.rb', line 4

def self.parse(line)
  match = line.match(/^\[GNUPG:\] IMPORTED (.*?) (.*)$/)
  new(
      raw: line,
      key_id: match[1],
      user_id: match[2])
end

Instance Method Details

#==(other) ⇒ Object



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

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

#typeObject



23
24
25
# File 'lib/ruby_gpg2/status_lines/imported.rb', line 23

def type
  :imported
end