Sha256: d8cb26a1f5d851bef523d9b286b8e575a32218bfce6b0fa62e7cf6e07d698bbd

Contents?: true

Size: 1.16 KB

Versions: 12

Compression:

Stored size: 1.16 KB

Contents

module RubyGPG2
  class Key
    attr_reader(
        :type,
        :validity,
        :length,
        :algorithm,
        :id,
        :creation_date,
        :owner_trust,
        :capabilities,
        :compliance_modes,
        :origin,
        :fingerprint,
        :user_ids)

    def initialize(opts)
      @type = opts[:type]
      @validity = opts[:validity]
      @length = opts[:length]
      @algorithm = opts[:algorithm]
      @id = opts[:id]
      @creation_date = opts[:creation_date]
      @owner_trust = opts[:owner_trust]
      @capabilities = opts[:capabilities]
      @compliance_modes = opts[:compliance_modes]
      @origin = opts[:origin]
      @fingerprint = opts[:fingerprint]
      @user_ids = opts[:user_ids]
    end

    def primary_user_id
      @user_ids&.first
    end

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

    protected

    def state
      [
          @type,
          @validity,
          @length,
          @algorithm,
          @id,
          @creation_date,
          @owner_trust,
          @capabilities,
          @compliance_modes,
          @origin,
          @fingerprint
      ]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby_gpg2-0.1.0.pre.18 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.17 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.16 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.15 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.14 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.13 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.12 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.11 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.10 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.9 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.8 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.7 lib/ruby_gpg2/key.rb