Class: SpeedtestNet::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, server, download, upload, latency) ⇒ Config

Returns a new instance of Config.



15
16
17
18
19
20
21
# File 'lib/speedtest_net/config.rb', line 15

def initialize(client, server, download, upload, latency)
  @client = client
  @server = server
  @download = download
  @upload = upload
  @latency = latency
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



11
12
13
# File 'lib/speedtest_net/config.rb', line 11

def client
  @client
end

#downloadObject (readonly)

Returns the value of attribute download.



11
12
13
# File 'lib/speedtest_net/config.rb', line 11

def download
  @download
end

#latencyObject (readonly)

Returns the value of attribute latency.



11
12
13
# File 'lib/speedtest_net/config.rb', line 11

def latency
  @latency
end

#serverObject (readonly)

Returns the value of attribute server.



11
12
13
# File 'lib/speedtest_net/config.rb', line 11

def server
  @server
end

#uploadObject (readonly)

Returns the value of attribute upload.



11
12
13
# File 'lib/speedtest_net/config.rb', line 11

def upload
  @upload
end

Class Method Details

.clear_cacheObject



31
32
33
# File 'lib/speedtest_net/config.rb', line 31

def clear_cache
  @instance_cache = nil
end

.fetchObject



24
25
26
27
28
29
# File 'lib/speedtest_net/config.rb', line 24

def fetch
  return @instance_cache unless @instance_cache.nil?

  elements = fetch_config
  @instance_cache = create_instance(elements)
end