Class: Proteus::DefinitionHelper
- Inherits:
-
Object
- Object
- Proteus::DefinitionHelper
- Defined in:
- lib/DefinitionHelper.rb
Instance Attribute Summary collapse
-
#definition_parser ⇒ Object
Returns the value of attribute definition_parser.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#get_class(class_path, current_ns) ⇒ Object
Returns the given class.
-
#initialize(definition_parser = nil, path = nil) ⇒ DefinitionHelper
constructor
————————————————————————— Constructor —————————————————————————.
Constructor Details
#initialize(definition_parser = nil, path = nil) ⇒ DefinitionHelper
Constructor
40 41 42 43 44 45 46 |
# File 'lib/DefinitionHelper.rb', line 40 def initialize( definition_parser = nil, path = nil ) @path = path @definition_parser = definition_parser @loaded_classes = {} @loading = [] end |
Instance Attribute Details
#definition_parser ⇒ Object
Returns the value of attribute definition_parser.
56 57 58 |
# File 'lib/DefinitionHelper.rb', line 56 def definition_parser @definition_parser end |
#path ⇒ Object
Returns the value of attribute path.
56 57 58 |
# File 'lib/DefinitionHelper.rb', line 56 def path @path end |
Instance Method Details
#get_class(class_path, current_ns) ⇒ Object
Returns the given class.
class_path: an array containing the namespaces and class id of the class current_ns: the current namespace, an array of namespace identifiers
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/DefinitionHelper.rb', line 76 def get_class( class_path, current_ns ) current_ns = current_ns || [] # 1. Search the current namespace # 2. Search the default namespace begin result = find_class( current_ns.concat(class_path) ) rescue Exceptions::DefinitionUnavailable result = find_class( class_path ) end end |