Class: Baya::Configuration::File
- Inherits:
-
Object
- Object
- Baya::Configuration::File
- Defined in:
- lib/baya/configuration/file.rb
Instance Method Summary collapse
- #adapters ⇒ Object
-
#initialize(file) ⇒ File
constructor
A new instance of File.
- #root ⇒ Object
Constructor Details
#initialize(file) ⇒ File
Returns a new instance of File.
7 8 9 10 |
# File 'lib/baya/configuration/file.rb', line 7 def initialize(file) json = ::File.open(file).read @data = Yajl::Parser.parse(json) end |
Instance Method Details
#adapters ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/baya/configuration/file.rb', line 16 def adapters (@data['adapters'] || []).map do |a| adapter = OpenStruct.new adapter.type = a["type"] adapter.mode = a["mode"] adapter.config = a["config"] adapter end end |
#root ⇒ Object
12 13 14 |
# File 'lib/baya/configuration/file.rb', line 12 def root @root ||= ::File.(@data['root']) end |