Class: GlobalSettings

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

Overview

Settings to configure this gem

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.certString

Returns Path to HTTPS cert.

Returns:

  • (String)

    Path to HTTPS cert



26
27
28
# File 'lib/file_sv/global_settings.rb', line 26

def cert
  @cert
end

.default_methodString

Returns Default REST method when none specified by filename.

Returns:

  • (String)

    Default REST method when none specified by filename



18
19
20
# File 'lib/file_sv/global_settings.rb', line 18

def default_method
  @default_method
end

.empty_body_statusInteger

Returns Default status of response when file is empty.

Returns:

  • (Integer)

    Default status of response when file is empty



20
21
22
# File 'lib/file_sv/global_settings.rb', line 20

def empty_body_status
  @empty_body_status
end

.httpsBoolean

Returns Whether to serve https using self signed certificate. Deprecated now.

Returns:

  • (Boolean)

    Whether to serve https using self signed certificate. Deprecated now



24
25
26
# File 'lib/file_sv/global_settings.rb', line 24

def https
  @https
end

.ignore_filesArray

Returns Expression representing files to ignore.

Returns:

  • (Array)

    Expression representing files to ignore



22
23
24
# File 'lib/file_sv/global_settings.rb', line 22

def ignore_files
  @ignore_files
end

.ignore_status_codesArray

Returns List of http status codes to ignore.

Returns:

  • (Array)

    List of http status codes to ignore



30
31
32
# File 'lib/file_sv/global_settings.rb', line 30

def ignore_status_codes
  @ignore_status_codes
end

.keyString

Returns Path to HTTPS key.

Returns:

  • (String)

    Path to HTTPS key



28
29
30
# File 'lib/file_sv/global_settings.rb', line 28

def key
  @key
end

.serving_folderString

Returns Path from current location to serve folders from.

Returns:

  • (String)

    Path from current location to serve folders from



32
33
34
# File 'lib/file_sv/global_settings.rb', line 32

def serving_folder
  @serving_folder
end

Class Method Details

.ignored_status?(status_code) ⇒ Boolean

Returns Whether status code is currently ignored.

Parameters:

  • status_code (Integer)

    HTTP status code

Returns:

  • (Boolean)

    Whether status code is currently ignored



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/file_sv/global_settings.rb', line 36

def ignored_status?(status_code)
  return unless ignore_status_codes

  ignore_status_codes.split(",").each do |code|
    regex = Regexp.new code.to_s
    result = status_code.to_s[regex]
    next unless result

    return true unless result.empty?
  end
  false
end