Module: Serializer::RSON::Class
- Included in:
- Serializer::RSON
- Defined in:
- lib/serializer/rson/class.rb
Instance Method Summary collapse
Instance Method Details
#load(params = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/serializer/rson/class.rb', line 20 def load(params={}) buffer = params.fetch(:buffer,nil) if buffer.nil? file_path = params.fetch(:file_path) file_name = params.fetch(:file_name) file_path = File.join( File.(file_path), file_name ) buffer = IO.read(file_path) end instance = new(buffer) instance.hydrate rescue Parser::SyntaxError => e puts 'in RSON file /etc/config.rson' puts file_path if buffer.nil? raise e end |