Commit 553f420

mo khan <mo@mokhan.ca>
2014-07-25 19:53:08
extract method to fetch secret.
1 parent fe86724
Changed files (1)
lib/in/totp_command.rb
@@ -6,10 +6,15 @@ module In
 
     def run(arguments)
       name = arguments.first
-      secret = @storage.transaction(true) do
+      ::ROTP::TOTP.new(secret_for(name)).now
+    end
+
+    private
+
+    def secret_for(name)
+      @storage.transaction(true) do
         @storage[name]
       end
-      ::ROTP::TOTP.new(secret).now
     end
   end
 end