lib/nanook/key.rb in nanook-0.7.0 vs lib/nanook/key.rb in nanook-1.0.0
- old
+ new
@@ -1,11 +1,11 @@
class Nanook
class Key
- def initialize(key=nil, rpc)
- @key = key
+ def initialize(rpc, key=nil)
@rpc = rpc
+ @key = key
end
def generate(seed: nil, index: nil)
if seed.nil? && index.nil?
rpc(:key_create)
@@ -14,12 +14,20 @@
else
raise ArgumentError.new("This method must be called with either seed AND index params given or no params")
end
end
+ def id
+ @key
+ end
+
def info
key_required!
rpc(:key_expand)
+ end
+
+ def inspect # :nodoc:
+ "#{self.class.name}(id: \"#{id}\", object_id: \"#{"0x00%x" % (object_id << 1)}\")"
end
private
def rpc(action, params={})