Class: Rsense::Server::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



13
14
15
16
17
# File 'lib/rsense/server/config.rb', line 13

def initialize
  @searched = []
  @ignores = []
  @errors = []
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



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

def errors
  @errors
end

#ignoresObject

Returns the value of attribute ignores.



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

def ignores
  @ignores
end

#options(config_path) ⇒ Object

Returns the value of attribute options.



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

def options
  @options
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#searchedObject

Returns the value of attribute searched.



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

def searched
  @searched
end

Instance Method Details

#check_options(name) ⇒ Object



58
59
60
# File 'lib/rsense/server/config.rb', line 58

def check_options(name)
  @options.rest[name] if @options.rest.key?(name)
end

#search(path_str = "~") ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rsense/server/config.rb', line 19

def search(path_str="~")
  path = FileTree.new(path_str)
  return if @searched.include?(path)
  @searched << path
  conf = path.join(".rsense").expand_path
  unless conf.exist?
    unless path.parent == path
      conf = search(path.parent)
    end
  end
  conf
end

#set_up(path) ⇒ Object



62
63
64
65
66
67
# File 'lib/rsense/server/config.rb', line 62

def set_up(path)
  conf = search(path)
  if conf
    options(conf)
  end
end