Class: Radikocopy::Config
- Inherits:
-
Object
- Object
- Radikocopy::Config
- Defined in:
- lib/radikocopy.rb
Instance Attribute Summary collapse
-
#import_scpt ⇒ Object
readonly
Returns the value of attribute import_scpt.
-
#keep ⇒ Object
readonly
Returns the value of attribute keep.
-
#local_dir ⇒ Object
readonly
Returns the value of attribute local_dir.
-
#remote_dir ⇒ Object
readonly
Returns the value of attribute remote_dir.
-
#remote_host ⇒ Object
readonly
Returns the value of attribute remote_host.
Instance Method Summary collapse
-
#initialize(config) ⇒ Config
constructor
A new instance of Config.
- #local_only? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(config) ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/radikocopy.rb', line 8 def initialize(config) @config = config @remote_host = config_value("remote", "host", false) @remote_dir = config_value("remote", "dir", false) @local_dir = config_value("local", "dir", true) unless FileTest.directory?(@local_dir) raise RuntimeError, "local_dir does not exists: #{@local_dir}" end dir = File.dirname(File.(__FILE__)) @import_scpt = File.join(dir, "radikoimport.scpt") @keep = 10 end |
Instance Attribute Details
#import_scpt ⇒ Object (readonly)
Returns the value of attribute import_scpt.
21 22 23 |
# File 'lib/radikocopy.rb', line 21 def import_scpt @import_scpt end |
#keep ⇒ Object (readonly)
Returns the value of attribute keep.
21 22 23 |
# File 'lib/radikocopy.rb', line 21 def keep @keep end |
#local_dir ⇒ Object (readonly)
Returns the value of attribute local_dir.
21 22 23 |
# File 'lib/radikocopy.rb', line 21 def local_dir @local_dir end |
#remote_dir ⇒ Object (readonly)
Returns the value of attribute remote_dir.
21 22 23 |
# File 'lib/radikocopy.rb', line 21 def remote_dir @remote_dir end |
#remote_host ⇒ Object (readonly)
Returns the value of attribute remote_host.
21 22 23 |
# File 'lib/radikocopy.rb', line 21 def remote_host @remote_host end |
Instance Method Details
#local_only? ⇒ Boolean
31 32 33 |
# File 'lib/radikocopy.rb', line 31 def local_only? @remote_host.nil? || @remote_dir.nil? end |
#to_s ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/radikocopy.rb', line 23 def to_s str = '' str << "remote_host: #{remote_host}\n" str << "remote_dir: #{remote_dir}\n" str << "local_dir: #{local_dir}\n" str << "import_scpt: #{import_scpt}\n" end |