Class: RRRSpec::Configuration

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

Direct Known Subclasses

RRRSpec::Client::ClientConfiguration

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loadedObject

Returns the value of attribute loaded.



3
4
5
# File 'lib/rrrspec/configuration.rb', line 3

def loaded
  @loaded
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/rrrspec/configuration.rb', line 4

def type
  @type
end

Instance Method Details

#check_validityObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/rrrspec/configuration.rb', line 18

def check_validity
  validity = true

  unless @redis_value
    $stderr.puts("Redis configuration is empty")
    validity = false
  end

  validity
end

#load_files(files) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rrrspec/configuration.rb', line 29

def load_files(files)
  loaded = []
  files.each do |filepath|
    filepath = File.absolute_path(filepath)
    next unless File.exists?(filepath)
    $stderr.puts("Loading: #{filepath}")
    load filepath
    loaded << filepath
  end

  RRRSpec.configuration.loaded = loaded
end

#redisObject



10
11
12
13
14
15
16
# File 'lib/rrrspec/configuration.rb', line 10

def redis
  case @redis_value
  when Hash then Redis.new(@redis_value)
  when Proc then @redis_value.call
  else @redis_value
  end
end

#redis=(arg) ⇒ Object



6
7
8
# File 'lib/rrrspec/configuration.rb', line 6

def redis=(arg)
  @redis_value = arg
end