Sha256: 86575667ccee8c443f2b095e25d72d159f22079343c6d312f592b8c29fc908ec

Contents?: true

Size: 1.25 KB

Versions: 23

Compression:

Stored size: 1.25 KB

Contents

module RubyGPG2
  class Key
    attr_reader(
        :type,
        :validity,
        :length,
        :algorithm,
        :id,
        :creation_date,
        :owner_trust,
        :capabilities,
        :serial_number,
        :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]
      @serial_number = opts[:serial_number]
      @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,
          @serial_number,
          @compliance_modes,
          @origin,
          @fingerprint
      ]
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ruby_gpg2-0.9.0.pre.6 lib/ruby_gpg2/key.rb
ruby_gpg2-0.9.0.pre.5 lib/ruby_gpg2/key.rb
ruby_gpg2-0.9.0.pre.4 lib/ruby_gpg2/key.rb
ruby_gpg2-0.9.0.pre.3 lib/ruby_gpg2/key.rb
ruby_gpg2-0.9.0.pre.2 lib/ruby_gpg2/key.rb
ruby_gpg2-0.9.0.pre.1 lib/ruby_gpg2/key.rb
ruby_gpg2-0.8.0 lib/ruby_gpg2/key.rb
ruby_gpg2-0.7.0.pre.1 lib/ruby_gpg2/key.rb
ruby_gpg2-0.6.0 lib/ruby_gpg2/key.rb
ruby_gpg2-0.5.0.pre.1 lib/ruby_gpg2/key.rb
ruby_gpg2-0.4.0 lib/ruby_gpg2/key.rb
ruby_gpg2-0.3.0.pre.2 lib/ruby_gpg2/key.rb
ruby_gpg2-0.3.0.pre.1 lib/ruby_gpg2/key.rb
ruby_gpg2-0.2.0 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.27 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.26 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.25 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.24 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.23 lib/ruby_gpg2/key.rb
ruby_gpg2-0.1.0.pre.22 lib/ruby_gpg2/key.rb