Class: Swappy::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_data, link_root, source_root) ⇒ Config

Returns a new instance of Config.



5
6
7
8
9
# File 'lib/swappy/config.rb', line 5

def initialize(json_data, link_root, source_root)
  @link_root = link_root
  @source_root = source_root
  @json_data = json_data
end

Instance Attribute Details

#json_dataObject (readonly)

Returns the value of attribute json_data.



3
4
5
# File 'lib/swappy/config.rb', line 3

def json_data
  @json_data
end

Returns the value of attribute link_root.



3
4
5
# File 'lib/swappy/config.rb', line 3

def link_root
  @link_root
end

#source_rootObject (readonly)

Returns the value of attribute source_root.



3
4
5
# File 'lib/swappy/config.rb', line 3

def source_root
  @source_root
end

Instance Method Details



11
12
13
# File 'lib/swappy/config.rb', line 11

def link_file
  json_data[0]
end


19
20
21
# File 'lib/swappy/config.rb', line 19

def link_path
  File.expand_path(File.join(link_root, link_file))
end

#source_fileObject



15
16
17
# File 'lib/swappy/config.rb', line 15

def source_file
  json_data[1]
end

#source_pathObject



23
24
25
# File 'lib/swappy/config.rb', line 23

def source_path
  File.expand_path(File.join(source_root, source_file))
end