Class: OpenStudio::Workflow::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio/workflow/adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Adapter

Returns a new instance of Adapter.



26
27
28
29
30
# File 'lib/openstudio/workflow/adapter.rb', line 26

def initialize(options = {})
  @options = options
  @log = nil
  @datapoint = nil
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



24
25
26
# File 'lib/openstudio/workflow/adapter.rb', line 24

def options
  @options
end

Instance Method Details

#add_directory_to_zip(zip_file, local_directory, root_directory) ⇒ Object

Submethod for adding the directory to the zip folder.



72
73
74
75
76
77
78
79
80
81
# File 'lib/openstudio/workflow/adapter.rb', line 72

def add_directory_to_zip(zip_file, local_directory, root_directory)
  Dir[File.join("#{local_directory}", '**', '**')].each do |file|
    # remove the base directory from the zip file
    rel_dir = local_directory.sub("#{root_directory}/", '')
    zip_file_to_add = file.gsub("#{local_directory}", "#{rel_dir}")
    zip_file.add(zip_file_to_add, file)
  end

  zip_file
end

#communicate_complete(id) ⇒ Object



55
56
57
# File 'lib/openstudio/workflow/adapter.rb', line 55

def communicate_complete(id)
  instance.communicate_complete id
end

#communicate_failure(id) ⇒ Object



59
60
61
# File 'lib/openstudio/workflow/adapter.rb', line 59

def communicate_failure(id)
  instance.communicate_failure id
end

#communicate_results(id, results) ⇒ Object



51
52
53
# File 'lib/openstudio/workflow/adapter.rb', line 51

def communicate_results(id, results)
  instance.communicate_results id, results
end

#communicate_started(id, _options = {}) ⇒ Object



39
40
41
# File 'lib/openstudio/workflow/adapter.rb', line 39

def communicate_started(id, _options = {})
  instance.communicate_started id
end

#get_datapoint(id, options = {}) ⇒ Object



43
44
45
# File 'lib/openstudio/workflow/adapter.rb', line 43

def get_datapoint(id, options = {})
  instance.get_datapoint id, options
end

#get_logger(file, options = {}) ⇒ Object



63
64
65
# File 'lib/openstudio/workflow/adapter.rb', line 63

def get_logger(file, options = {})
  instance.get_logger file, options
end

#get_problem(id, options = {}) ⇒ Object



47
48
49
# File 'lib/openstudio/workflow/adapter.rb', line 47

def get_problem(id, options = {})
  instance.get_problem id, options
end

#load(filename, options = {}) ⇒ Object

class << self attr_reader :problem



35
36
37
# File 'lib/openstudio/workflow/adapter.rb', line 35

def load(filename, options = {})
  instance.load(filename, options)
end