class Eco::API::Session::Config::Files

Public Class Methods

new(config:) click to toggle source
# File lib/eco/api/session/config/files.rb, line 7
def initialize(config:)
  super(config: config)
  @validations = {}
end

Public Instance Methods

add_validation(format) click to toggle source
# File lib/eco/api/session/config/files.rb, line 35
def add_validation(format)
  raise "Block must be given" unless block_given?
  @validations[format] = Proc.new
end
timestamp_pattern() click to toggle source
# File lib/eco/api/session/config/files.rb, line 31
def timestamp_pattern
  self["timestamp_pattern"]
end
timestamp_pattern=(pattern) click to toggle source
# File lib/eco/api/session/config/files.rb, line 27
def timestamp_pattern=(pattern)
  self["timestamp_pattern"] = pattern
end
validate(format, input) click to toggle source
# File lib/eco/api/session/config/files.rb, line 40
def validate(format, input)
  @validations[format].call(input) if  @validations.key?(format)
end
working_directory() click to toggle source
# File lib/eco/api/session/config/files.rb, line 16
def working_directory
  if config.apis.active_api&.one_off?
    one_off_dir = File.join("one_off", config.apis.active_name.to_s)
    unless full_path = Eco::Data::Files::Directory.new(one_off_dir).create
      raise "Could not create the folder '#{full_path}'"
    end
    self["dir"] = one_off_dir
  end
  self["dir"]
end
working_directory=(path) click to toggle source
# File lib/eco/api/session/config/files.rb, line 12
def working_directory=(path)
  self["dir"] = path
end