Class: Rsense::Server::Config
- Inherits:
-
Object
- Object
- Rsense::Server::Config
- Defined in:
- lib/rsense/server/config.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#ignores ⇒ Object
Returns the value of attribute ignores.
-
#options(config_path) ⇒ Object
Returns the value of attribute options.
-
#port ⇒ Object
Returns the value of attribute port.
-
#searched ⇒ Object
Returns the value of attribute searched.
Instance Method Summary collapse
- #check_options(name) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #search(path_str = "~", level = 0) ⇒ Object
- #set_up(path) ⇒ Object
Constructor Details
#initialize ⇒ Config
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
#errors ⇒ Object
Returns the value of attribute errors.
11 12 13 |
# File 'lib/rsense/server/config.rb', line 11 def errors @errors end |
#ignores ⇒ Object
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 end |
#port ⇒ Object
Returns the value of attribute port.
11 12 13 |
# File 'lib/rsense/server/config.rb', line 11 def port @port end |
#searched ⇒ Object
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
64 65 66 |
# File 'lib/rsense/server/config.rb', line 64 def (name) @options.rest[name] if @options.rest.key?(name) end |
#search(path_str = "~", level = 0) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rsense/server/config.rb', line 19 def search(path_str="~", level=0) level = level + 1 path = FileTree.new(path_str) return if @searched.include?(path) @searched << path conf = path.join(".rsense"). unless conf.exist? if path.parent == path || level == 3 contender = Pathname.new("~").join(".rsense"). conf = contender if contender.exist? else conf = search(path.parent, level) end end conf end |
#set_up(path) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/rsense/server/config.rb', line 68 def set_up(path) conf = search(path) if conf (conf) end end |