зеркало из https://github.com/github/ruby-gpgme.git
Fix Key#inspect, Key#to_s, SubKey#inspect, & SubKey#to_s on 1.8.
* sprintf('%c', 'a') works fine on 1.9, but on 1.8 it raises "TypeError: can't convert String into Integer"
This commit is contained in:
Родитель
c213840f65
Коммит
8058b4454f
|
@ -208,7 +208,7 @@ module GPGME
|
|||
end
|
||||
|
||||
def inspect
|
||||
sprintf("#<#{self.class} %s %4d%c/%s %s trust=%s, owner_trust=%s, \
|
||||
sprintf("#<#{self.class} %s %4d%s/%s %s trust=%s, owner_trust=%s, \
|
||||
capability=%s, subkeys=%s, uids=%s>",
|
||||
primary_subkey.secret? ? 'sec' : 'pub',
|
||||
primary_subkey.length,
|
||||
|
@ -224,7 +224,7 @@ capability=%s, subkeys=%s, uids=%s>",
|
|||
|
||||
def to_s
|
||||
primary_subkey = subkeys[0]
|
||||
s = sprintf("%s %4d%c/%s %s\n",
|
||||
s = sprintf("%s %4d%s/%s %s\n",
|
||||
primary_subkey.secret? ? 'sec' : 'pub',
|
||||
primary_subkey.length,
|
||||
primary_subkey.pubkey_algo_letter,
|
||||
|
|
|
@ -36,7 +36,7 @@ module GPGME
|
|||
end
|
||||
|
||||
def inspect
|
||||
sprintf("#<#{self.class} %s %4d%c/%s %s trust=%s, capability=%s>",
|
||||
sprintf("#<#{self.class} %s %4d%s/%s %s trust=%s, capability=%s>",
|
||||
secret? ? 'ssc' : 'sub',
|
||||
length,
|
||||
pubkey_algo_letter,
|
||||
|
@ -47,7 +47,7 @@ module GPGME
|
|||
end
|
||||
|
||||
def to_s
|
||||
sprintf("%s %4d%c/%s %s\n",
|
||||
sprintf("%s %4d%s/%s %s\n",
|
||||
secret? ? 'ssc' : 'sub',
|
||||
length,
|
||||
pubkey_algo_letter,
|
||||
|
|
|
@ -183,5 +183,19 @@ describe GPGME::Key do
|
|||
|
||||
assert key.expired
|
||||
end
|
||||
|
||||
describe :inspect do
|
||||
it "can be inspected" do
|
||||
key = GPGME::Key.find(:secret).first
|
||||
key.inspect
|
||||
end
|
||||
end
|
||||
|
||||
describe :to_s do
|
||||
it "can be coerced into a String" do
|
||||
key = GPGME::Key.find(:secret).first
|
||||
key.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -28,4 +28,18 @@ describe GPGME::SubKey do
|
|||
end
|
||||
end
|
||||
|
||||
describe :inspect do
|
||||
it "can be inspected" do
|
||||
subkey = GPGME::Key.find(:secret).first.primary_subkey
|
||||
subkey.inspect
|
||||
end
|
||||
end
|
||||
|
||||
describe :to_s do
|
||||
it "can be coerced into a String" do
|
||||
subkey = GPGME::Key.find(:secret).first.primary_subkey
|
||||
subkey.to_s
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче