Skip to content

Commit

Permalink
Merge 9046bb5 into 5b3069d
Browse files Browse the repository at this point in the history
  • Loading branch information
ushis committed Sep 15, 2014
2 parents 5b3069d + 9046bb5 commit 08b8340
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/gpgme/key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ def delete!(allow_secret = false)
end
end

##
# Returns true if the key has an expiry date else false
def expires?
primary_subkey.expires?
end

##
# Returns the expiry date for this key
def expires
Expand Down
9 changes: 6 additions & 3 deletions lib/gpgme/sub_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ def timestamp
Time.at(@timestamp)
end

def expires?
@expires != 0
end

def expires
Time.at(@expires)
expires? ? Time.at(@expires) : nil
end

def expired
return false if @expires == 0
@expires < Time.now.to_i
expires? && @expires < Time.now.to_i
end

def sha
Expand Down

0 comments on commit 08b8340

Please sign in to comment.