Module: OmfEc::Backward::AppDefinition
- Included in:
- AppDefinition
- Defined in:
- omf_ec/lib/omf_ec/backward/app_definition.rb
Instance Method Summary (collapse)
-
- (Object) defMeasurement(name, &block)
XXX: This should be provided by the omf-oml glue.
-
- (Object) defMetric(name, type, opts = {})
Define metrics to measure.
-
- (Object) defProperty(name = :mandatory, description = nil, parameter = nil, options = {})
Add a new parameter to this Application Definition.
Instance Method Details
- (Object) defMeasurement(name, &block)
XXX: This should be provided by the omf-oml glue.
75 76 77 78 79 80 81 82 |
# File 'omf_ec/lib/omf_ec/backward/app_definition.rb', line 75 def defMeasurement(name,&block) mp = {:mp => name, :fields => []} @fields = [] # call the block with ourserlves to process its 'defMetric' statements block.call(self) if block @fields.each { |f| mp[:fields] << f } define_measurement_point(mp) end |
- (Object) defMetric(name, type, opts = {})
Define metrics to measure
68 69 70 71 72 |
# File 'omf_ec/lib/omf_ec/backward/app_definition.rb', line 68 def defMetric(name,type, opts = {}) # the third parameter used to be a description string opts = {:description => opts} if opts.class!=Hash @fields << {:field => name, :type => type}.merge(opts) end |
- (Object) defProperty(name = :mandatory, description = nil, parameter = nil, options = {})
Add a new parameter to this Application Definition. This method is for backward compatibility with previous OEDL 5.
The OML code-generation tool, oml2-scaffold extends the range of options supported in the options hash to support generation of popt(3) command line parsing code. As for the parameters, depending on the number of dashes (two/one) in parameter, it is used as the longName/shortName for popt(3), otherwise the former defaults to name, and the latter defaults to either :mnemonic or nothing.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'omf_ec/lib/omf_ec/backward/app_definition.rb', line 37 def defProperty(name = :mandatory, description = nil, parameter = nil, = {}) opts = {:description => description, :cmd => parameter} # Map old OMF5 types to OMF6 # Map OMF app property types to Ruby types [:type] = case [:type] when :integer, :int then 'Numeric' when :string then 'String' when :boolean then 'Boolean' when :double then 'Float' # For type that we cannot understand, DON'T send it else nil end opts = opts.merge() define_parameter(Hash[name,opts]) end |