lib/device.rb in narou-2.0.2 vs lib/device.rb in narou-2.1.0
- old
+ new
@@ -2,14 +2,28 @@
#
# Copyright 2013 whiteleaf. All rights reserved.
#
require "fileutils"
+require "memoist"
require_relative "narou"
require_relative "helper"
class Device
+ #
+ # デバイスの栞をバックアップするときに使う時に include する
+ #
+ module BackupBookmarkUtility
+ extend Memoist
+
+ # 栞データを管理するディレクトリのパスを取得
+ def get_storage_path
+ File.join(Narou.get_misc_dir, "bookmark", @name)
+ end
+ memoize :get_storage_path
+ end
+
case Helper.determine_os
when :windows
require_relative "device/library/windows"
extend Device::Library::Windows
when :cygwin
@@ -43,10 +57,11 @@
end
end
class UnknownDevice < StandardError; end
class SendFailure < StandardError; end
+ class DontConneting < StandardError; end
def self.exists?(device)
DEVICES.include?(device.downcase)
end
@@ -147,17 +162,16 @@
else
{}
end
end
- private
-
def create_device_check_methods
DEVICES.keys.each do |name|
instance_eval <<-EOS
def #{name}?
#{@name.downcase == name}
end
EOS
end
end
+ private :create_device_check_methods
end