class CelluloidBenchmark::Target
Attributes
http_auth_password[R]
http_auth_username[R]
key[R]
uri[R]
Public Class Methods
default_target()
click to toggle source
# File lib/celluloid_benchmark/target.rb, line 30 def self.default_target Target.new("local", "http://localhost") end
new(key, uri, http_auth_username = nil, http_auth_password = nil)
click to toggle source
# File lib/celluloid_benchmark/target.rb, line 34 def initialize(key, uri, http_auth_username = nil, http_auth_password = nil) @http_auth_password = http_auth_password @http_auth_username = http_auth_username @key = key @uri = uri end
new_from_key(key, config_file_path = nil)
click to toggle source
# File lib/celluloid_benchmark/target.rb, line 8 def self.new_from_key(key, config_file_path = nil) key ||= "local" config_file_path ||= "config/targets.yml" if key == "local" && !File.exist?(config_file_path) return default_target end configs = YAML.load_file(config_file_path) config = configs[key] unless config raise ArgumentError, "No target for '#{key}'" end if config["http_auth"] Target.new(key, config["uri"], config["http_auth"]["username"], config["http_auth"]["password"]) else Target.new(key, config["uri"]) end end
Public Instance Methods
http_auth?()
click to toggle source
# File lib/celluloid_benchmark/target.rb, line 41 def http_auth? http_auth_username && http_auth_password end