Class: Souffle::Config
- Inherits:
-
Object
- Object
- Souffle::Config
- Extended by:
- Mixlib::Config
- Defined in:
- lib/souffle/config.rb
Overview
The configuration object for the souffle server.
Class Method Summary collapse
-
.from_file(filename, parser = "ruby") ⇒ Object
Loads a given file and passes it to the appropriate parser.
-
.from_file_json(filename) ⇒ Object
Loads a given json file and merges the current context configuration with the updated hash.
-
.from_file_ruby(filename) ⇒ Object
Loads a given ruby file and runs instance_eval against it in the context of the current object.
-
.from_stream_json(input) ⇒ Object
Loads a given json input and merges the current context configuration with the updated hash.
-
.inspect ⇒ Object
Return the configuration itself upon inspection.
Class Method Details
.from_file(filename, parser = "ruby") ⇒ Object
Loads a given file and passes it to the appropriate parser.
19 20 21 |
# File 'lib/souffle/config.rb', line 19 def self.from_file(filename, parser="ruby") send("from_file_#{parser}".to_sym, filename) end |
.from_file_json(filename) ⇒ Object
Loads a given json file and merges the current context configuration with the updated hash.
40 41 42 |
# File 'lib/souffle/config.rb', line 40 def self.from_file_json(filename) self.from_stream_json(IO.read(filename)) end |
.from_file_ruby(filename) ⇒ Object
Loads a given ruby file and runs instance_eval against it in the context of the current object.
29 30 31 |
# File 'lib/souffle/config.rb', line 29 def self.from_file_ruby(filename) self.instance_eval(IO.read(filename), filename, 1) end |
.from_stream_json(input) ⇒ Object
Loads a given json input and merges the current context configuration with the updated hash.
51 52 53 54 |
# File 'lib/souffle/config.rb', line 51 def self.from_stream_json(input) parser = Yajl::Parser.new(:symbolize_keys => true) configuration.merge!(parser.parse(input)) end |
.inspect ⇒ Object
Return the configuration itself upon inspection.
10 11 12 |
# File 'lib/souffle/config.rb', line 10 def self.inspect configuration.inspect end |