lib/googleauth/stores/file_token_store.rb in googleauth-0.8.0 vs lib/googleauth/stores/file_token_store.rb in googleauth-0.8.1

- old
+ new

@@ -25,39 +25,39 @@ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -require 'yaml/store' -require 'googleauth/token_store' +require "yaml/store" +require "googleauth/token_store" module Google module Auth module Stores # Implementation of user token storage backed by a local YAML file class FileTokenStore < Google::Auth::TokenStore # Create a new store with the supplied file. # # @param [String, File] file # Path to storage file - def initialize(options = {}) + def initialize options = {} path = options[:file] - @store = YAML::Store.new(path) + @store = YAML::Store.new path end # (see Google::Auth::Stores::TokenStore#load) - def load(id) + def load id @store.transaction { @store[id] } end # (see Google::Auth::Stores::TokenStore#store) - def store(id, token) + def store id, token @store.transaction { @store[id] = token } end # (see Google::Auth::Stores::TokenStore#delete) - def delete(id) - @store.transaction { @store.delete(id) } + def delete id + @store.transaction { @store.delete id } end end end end end