Class: MODL::Parser::ClassProcessor
- Inherits:
-
Object
- Object
- MODL::Parser::ClassProcessor
- Defined in:
- lib/modl/parser/class_processor.rb
Overview
This class handles the conversion of objects that refer to classes into instances of those classes. It works recursively since class usage can be nested.
Constant Summary collapse
- MAX_RECURSION_DEPTH =
How deep can the class structure be?
20
Class Method Summary collapse
-
.process(global, obj) ⇒ Object
global is a GlobalParseContext and obj is the extracted Array or Hash from MODL::Parser::Parsed.extract_json.
Class Method Details
.process(global, obj) ⇒ Object
global is a GlobalParseContext and obj is the extracted Array or Hash from MODL::Parser::Parsed.extract_json
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/modl/parser/class_processor.rb', line 9 def self.process(global, obj) # Process each object in the array or just process the object if its a hash. # Any other object is ignored. raise StandardError, 'parameter "global" should be a GlobalParseContext' unless global.is_a?(GlobalParseContext) if obj.is_a? Array obj.each do |o| process_obj global, o if o.is_a? Hash end elsif obj.is_a? Hash process_obj global, obj end end |