Class: Linksta::Checker

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Checker

Returns a new instance of Checker.



55
56
57
# File 'lib/linksta.rb', line 55

def initialize(config)
  @config = YAML.load(File.open("#{config}"))
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



53
54
55
# File 'lib/linksta.rb', line 53

def config
  @config
end

Instance Method Details

#baseObject



59
60
61
# File 'lib/linksta.rb', line 59

def base
  config["base"]
end

#concurrencyObject



63
64
65
# File 'lib/linksta.rb', line 63

def concurrency
  config["concurrency"] ? config["concurrency"] : 100
end

#smokeObject



71
72
73
74
75
76
# File 'lib/linksta.rb', line 71

def smoke
  urls = config["paths"]
  options = config["headers"]
  headers = Hash[*options]
  Getter.new(urls, base, concurrency, status_code, { :headers => headers }).check
end

#status_codeObject



67
68
69
# File 'lib/linksta.rb', line 67

def status_code
  config["status_code"] ? config["status_code"] : 200
end