Class: Copland::Configuration::YAML::ConfigurationPointProcessor

Inherits:
Object
  • Object
show all
Includes:
TypeValidator
Defined in:
lib/copland/configuration/yaml/configuration-point.rb

Overview

This delegate is responsible for processing configuration points in a package descriptor.

Constant Summary collapse

VALID_KEYS =

The list of recognized key values in a configuration point element.

[ "description", "type", "schema" ]
REQUIRED_KEYS =

The list of required key values in a configuration point element.

[ "type" ]

Instance Method Summary collapse

Methods included from TypeValidator

#ensure_element_type, #validate_elements

Constructor Details

#initialize(package, options = {}) ⇒ ConfigurationPointProcessor

Creates a new ConfigurationPointProcessor that feeds into the given Package instance. The options are used while processing each configuration point.



51
52
53
54
55
# File 'lib/copland/configuration/yaml/configuration-point.rb', line 51

def initialize( package, options={} )
  @package = package
  @options = options
  @schema = SchemaParser.new
end

Instance Method Details

#process(name, doc) ⇒ Object

Create and return a new configuration point with the given name. Initialize it with the data in the doc parameter (which must be a Hash).



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/copland/configuration/yaml/configuration-point.rb', line 66

def process( name, doc )
  ensure_element_type "configuration-point", doc, Hash
  validate_elements doc

  factory = Copland::ClassFactory.instance
  point = factory.get( Copland::ConfigurationPoint::POOL_NAME,
    doc["type"], @package, name, @options )

  point.description = doc["description"]

  if doc['schema']
    point.schema = @schema.process( point, doc['schema'] )
  end

  return point
end