Class: Radikocopy::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/radikocopy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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.expand_path(__FILE__))
  @import_scpt = File.join(dir, "radikoimport.scpt")
  @keep = 10
end

Instance Attribute Details

#import_scptObject (readonly)

Returns the value of attribute import_scpt.



21
22
23
# File 'lib/radikocopy.rb', line 21

def import_scpt
  @import_scpt
end

#keepObject (readonly)

Returns the value of attribute keep.



21
22
23
# File 'lib/radikocopy.rb', line 21

def keep
  @keep
end

#local_dirObject (readonly)

Returns the value of attribute local_dir.



21
22
23
# File 'lib/radikocopy.rb', line 21

def local_dir
  @local_dir
end

#remote_dirObject (readonly)

Returns the value of attribute remote_dir.



21
22
23
# File 'lib/radikocopy.rb', line 21

def remote_dir
  @remote_dir
end

#remote_hostObject (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

Returns:

  • (Boolean)


31
32
33
# File 'lib/radikocopy.rb', line 31

def local_only?
  @remote_host.nil? || @remote_dir.nil?
end

#to_sObject



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