--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+
+ <title>Module: MCollective::DDL</title>
+
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
+
+ <script src="../js/jquery.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/quicksearch.js" type="text/javascript"
+ charset="utf-8"></script>
+ <script src="../js/darkfish.js" type="text/javascript"
+ charset="utf-8"></script>
+
+</head>
+<body class="module">
+
+ <div id="metadata">
+ <div id="file-metadata">
+ <div id="file-list-section" class="section">
+ <h3 class="section-header">In Files</h3>
+ <div class="section-body">
+ <ul>
+
+ <li><a href="../lib/mcollective/ddl/discoveryddl_rb.html?TB_iframe=true&height=550&width=785"
+ class="thickbox" title="lib/mcollective/ddl/discoveryddl.rb">lib/mcollective/ddl/discoveryddl.rb</a></li>
+
+ <li><a href="../lib/mcollective/ddl/validatorddl_rb.html?TB_iframe=true&height=550&width=785"
+ class="thickbox" title="lib/mcollective/ddl/validatorddl.rb">lib/mcollective/ddl/validatorddl.rb</a></li>
+
+ <li><a href="../lib/mcollective/ddl/agentddl_rb.html?TB_iframe=true&height=550&width=785"
+ class="thickbox" title="lib/mcollective/ddl/agentddl.rb">lib/mcollective/ddl/agentddl.rb</a></li>
+
+ <li><a href="../lib/mcollective/ddl/base_rb.html?TB_iframe=true&height=550&width=785"
+ class="thickbox" title="lib/mcollective/ddl/base.rb">lib/mcollective/ddl/base.rb</a></li>
+
+ <li><a href="../lib/mcollective/ddl/dataddl_rb.html?TB_iframe=true&height=550&width=785"
+ class="thickbox" title="lib/mcollective/ddl/dataddl.rb">lib/mcollective/ddl/dataddl.rb</a></li>
+
+ <li><a href="../lib/mcollective/ddl_rb.html?TB_iframe=true&height=550&width=785"
+ class="thickbox" title="lib/mcollective/ddl.rb">lib/mcollective/ddl.rb</a></li>
+
+ </ul>
+ </div>
+ </div>
+
+
+ </div>
+
+ <div id="class-metadata">
+
+ <!-- Parent Class -->
+
+
+ <!-- Namespace Contents -->
+
+ <div id="namespace-list-section" class="section">
+ <h3 class="section-header">Namespace</h3>
+ <ul class="link-list">
+
+ <li><span class="type">CLASS</span> <a href="DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DDL/Base.html">MCollective::DDL::Base</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
+
+ <li><span class="type">CLASS</span> <a href="DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
+
+ </ul>
+ </div>
+
+
+ <!-- Method Quickref -->
+
+ <div id="method-list-section" class="section">
+ <h3 class="section-header">Methods</h3>
+ <ul class="link-list">
+
+ <li><a href="#M000368">::load_and_cache</a></li>
+
+ <li><a href="#M000367">::new</a></li>
+
+ <li><a href="#M000369">::string_to_boolean</a></li>
+
+ <li><a href="#M000370">::string_to_number</a></li>
+
+ <li><a href="#M000371">::validation_fail!</a></li>
+
+ </ul>
+ </div>
+
+
+ <!-- Included Modules -->
+
+ </div>
+
+ <div id="project-metadata">
+
+
+ <div id="fileindex-section" class="section project-section">
+ <h3 class="section-header">Files</h3>
+ <ul>
+
+ <li class="file"><a href="../COPYING.html">COPYING</a></li>
+
+ <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
+
+ <li class="file"><a href="../README.html">README</a></li>
+
+ <li class="file"><a href="../Rakefile.html">Rakefile</a></li>
+
+ <li class="file"><a href="../etc/client_cfg_dist.html">client.cfg.dist</a></li>
+
+ <li class="file"><a href="../etc/data-help_erb.html">data-help.erb</a></li>
+
+ <li class="file"><a href="../etc/discovery-help_erb.html">discovery-help.erb</a></li>
+
+ <li class="file"><a href="../etc/facts_yaml_dist.html">facts.yaml.dist</a></li>
+
+ <li class="file"><a href="../etc/metadata-help_erb.html">metadata-help.erb</a></li>
+
+ <li class="file"><a href="../etc/msg-help_erb.html">msg-help.erb</a></li>
+
+ <li class="file"><a href="../etc/rpc-help_erb.html">rpc-help.erb</a></li>
+
+ <li class="file"><a href="../etc/server_cfg_dist.html">server.cfg.dist</a></li>
+
+ <li class="file"><a href="../etc/ssl/PLACEHOLDER.html">PLACEHOLDER</a></li>
+
+ <li class="file"><a href="../etc/ssl/clients/PLACEHOLDER.html">PLACEHOLDER</a></li>
+
+ <li class="file"><a href="../lib/mcollective/generators/templates/action_snippet_erb.html">action_snippet.erb</a></li>
+
+ <li class="file"><a href="../lib/mcollective/generators/templates/data_input_snippet_erb.html">data_input_snippet.erb</a></li>
+
+ <li class="file"><a href="../lib/mcollective/generators/templates/ddl_erb.html">ddl.erb</a></li>
+
+ <li class="file"><a href="../lib/mcollective/generators/templates/plugin_erb.html">plugin.erb</a></li>
+
+ <li class="file"><a href="../lib/mcollective/locales/en_yml.html">en.yml</a></li>
+
+ <li class="file"><a href="../mcollective_init.html">mcollective.init</a></li>
+
+ </ul>
+ </div>
+
+
+ <div id="classindex-section" class="section project-section">
+ <h3 class="section-header">Class Index
+ <span class="search-toggle"><img src="../images/find.png"
+ height="16" width="16" alt="[+]"
+ title="show/hide quicksearch" /></span></h3>
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
+ <fieldset>
+ <legend>Quicksearch</legend>
+ <input type="text" name="quicksearch" value=""
+ class="quicksearch-field" />
+ </fieldset>
+ </form>
+
+ <ul class="link-list">
+
+ <li><a href="../MCollective.html">MCollective</a></li>
+
+ <li><a href="../MCollective/Agent.html">MCollective::Agent</a></li>
+
+ <li><a href="../MCollective/Agents.html">MCollective::Agents</a></li>
+
+ <li><a href="../MCollective/Aggregate.html">MCollective::Aggregate</a></li>
+
+ <li><a href="../MCollective/Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
+
+ <li><a href="../MCollective/Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
+
+ <li><a href="../MCollective/Aggregate/Result/Base.html">MCollective::Aggregate::Result::Base</a></li>
+
+ <li><a href="../MCollective/Aggregate/Result/CollectionResult.html">MCollective::Aggregate::Result::CollectionResult</a></li>
+
+ <li><a href="../MCollective/Aggregate/Result/NumericResult.html">MCollective::Aggregate::Result::NumericResult</a></li>
+
+ <li><a href="../MCollective/Application.html">MCollective::Application</a></li>
+
+ <li><a href="../MCollective/Applications.html">MCollective::Applications</a></li>
+
+ <li><a href="../MCollective/Cache.html">MCollective::Cache</a></li>
+
+ <li><a href="../MCollective/Client.html">MCollective::Client</a></li>
+
+ <li><a href="../MCollective/CodedError.html">MCollective::CodedError</a></li>
+
+ <li><a href="../MCollective/Config.html">MCollective::Config</a></li>
+
+ <li><a href="../MCollective/Connector.html">MCollective::Connector</a></li>
+
+ <li><a href="../MCollective/Connector/Base.html">MCollective::Connector::Base</a></li>
+
+ <li><a href="../MCollective/DDL.html">MCollective::DDL</a></li>
+
+ <li><a href="../MCollective/DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
+
+ <li><a href="../MCollective/DDL/Base.html">MCollective::DDL::Base</a></li>
+
+ <li><a href="../MCollective/DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
+
+ <li><a href="../MCollective/DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
+
+ <li><a href="../MCollective/DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
+
+ <li><a href="../MCollective/DDLValidationError.html">MCollective::DDLValidationError</a></li>
+
+ <li><a href="../MCollective/Data.html">MCollective::Data</a></li>
+
+ <li><a href="../MCollective/Data/Base.html">MCollective::Data::Base</a></li>
+
+ <li><a href="../MCollective/Data/Result.html">MCollective::Data::Result</a></li>
+
+ <li><a href="../MCollective/Discovery.html">MCollective::Discovery</a></li>
+
+ <li><a href="../MCollective/Facts.html">MCollective::Facts</a></li>
+
+ <li><a href="../MCollective/Facts/Base.html">MCollective::Facts::Base</a></li>
+
+ <li><a href="../MCollective/Generators.html">MCollective::Generators</a></li>
+
+ <li><a href="../MCollective/Generators/AgentGenerator.html">MCollective::Generators::AgentGenerator</a></li>
+
+ <li><a href="../MCollective/Generators/Base.html">MCollective::Generators::Base</a></li>
+
+ <li><a href="../MCollective/Generators/DataGenerator.html">MCollective::Generators::DataGenerator</a></li>
+
+ <li><a href="../MCollective/InvalidRPCData.html">MCollective::InvalidRPCData</a></li>
+
+ <li><a href="../MCollective/Log.html">MCollective::Log</a></li>
+
+ <li><a href="../MCollective/Logger.html">MCollective::Logger</a></li>
+
+ <li><a href="../MCollective/Logger/Base.html">MCollective::Logger::Base</a></li>
+
+ <li><a href="../MCollective/Logger/Console_logger.html">MCollective::Logger::Console_logger</a></li>
+
+ <li><a href="../MCollective/Logger/File_logger.html">MCollective::Logger::File_logger</a></li>
+
+ <li><a href="../MCollective/Logger/Syslog_logger.html">MCollective::Logger::Syslog_logger</a></li>
+
+ <li><a href="../MCollective/Matcher.html">MCollective::Matcher</a></li>
+
+ <li><a href="../MCollective/Matcher/Parser.html">MCollective::Matcher::Parser</a></li>
+
+ <li><a href="../MCollective/Matcher/Scanner.html">MCollective::Matcher::Scanner</a></li>
+
+ <li><a href="../MCollective/Message.html">MCollective::Message</a></li>
+
+ <li><a href="../MCollective/MissingRPCData.html">MCollective::MissingRPCData</a></li>
+
+ <li><a href="../MCollective/MsgDoesNotMatchRequestID.html">MCollective::MsgDoesNotMatchRequestID</a></li>
+
+ <li><a href="../MCollective/MsgTTLExpired.html">MCollective::MsgTTLExpired</a></li>
+
+ <li><a href="../MCollective/NotTargettedAtUs.html">MCollective::NotTargettedAtUs</a></li>
+
+ <li><a href="../MCollective/Optionparser.html">MCollective::Optionparser</a></li>
+
+ <li><a href="../MCollective/PluginManager.html">MCollective::PluginManager</a></li>
+
+ <li><a href="../MCollective/PluginPackager.html">MCollective::PluginPackager</a></li>
+
+ <li><a href="../MCollective/PluginPackager/AgentDefinition.html">MCollective::PluginPackager::AgentDefinition</a></li>
+
+ <li><a href="../MCollective/PluginPackager/StandardDefinition.html">MCollective::PluginPackager::StandardDefinition</a></li>
+
+ <li><a href="../MCollective/RPC.html">MCollective::RPC</a></li>
+
+ <li><a href="../MCollective/RPC/ActionRunner.html">MCollective::RPC::ActionRunner</a></li>
+
+ <li><a href="../MCollective/RPC/Agent.html">MCollective::RPC::Agent</a></li>
+
+ <li><a href="../MCollective/RPC/Audit.html">MCollective::RPC::Audit</a></li>
+
+ <li><a href="../MCollective/RPC/Client.html">MCollective::RPC::Client</a></li>
+
+ <li><a href="../MCollective/RPC/Helpers.html">MCollective::RPC::Helpers</a></li>
+
+ <li><a href="../MCollective/RPC/Progress.html">MCollective::RPC::Progress</a></li>
+
+ <li><a href="../MCollective/RPC/Reply.html">MCollective::RPC::Reply</a></li>
+
+ <li><a href="../MCollective/RPC/Request.html">MCollective::RPC::Request</a></li>
+
+ <li><a href="../MCollective/RPC/Result.html">MCollective::RPC::Result</a></li>
+
+ <li><a href="../MCollective/RPC/Stats.html">MCollective::RPC::Stats</a></li>
+
+ <li><a href="../MCollective/RPCAborted.html">MCollective::RPCAborted</a></li>
+
+ <li><a href="../MCollective/RPCError.html">MCollective::RPCError</a></li>
+
+ <li><a href="../MCollective/Registration.html">MCollective::Registration</a></li>
+
+ <li><a href="../MCollective/Registration/Base.html">MCollective::Registration::Base</a></li>
+
+ <li><a href="../MCollective/Runner.html">MCollective::Runner</a></li>
+
+ <li><a href="../MCollective/RunnerStats.html">MCollective::RunnerStats</a></li>
+
+ <li><a href="../MCollective/SSL.html">MCollective::SSL</a></li>
+
+ <li><a href="../MCollective/Security.html">MCollective::Security</a></li>
+
+ <li><a href="../MCollective/Security/Base.html">MCollective::Security::Base</a></li>
+
+ <li><a href="../MCollective/SecurityValidationFailed.html">MCollective::SecurityValidationFailed</a></li>
+
+ <li><a href="../MCollective/Shell.html">MCollective::Shell</a></li>
+
+ <li><a href="../MCollective/Translatable.html">MCollective::Translatable</a></li>
+
+ <li><a href="../MCollective/UnixDaemon.html">MCollective::UnixDaemon</a></li>
+
+ <li><a href="../MCollective/UnknownRPCAction.html">MCollective::UnknownRPCAction</a></li>
+
+ <li><a href="../MCollective/UnknownRPCError.html">MCollective::UnknownRPCError</a></li>
+
+ <li><a href="../MCollective/Util.html">MCollective::Util</a></li>
+
+ <li><a href="../MCollective/Validator.html">MCollective::Validator</a></li>
+
+ <li><a href="../MCollective/ValidatorError.html">MCollective::ValidatorError</a></li>
+
+ <li><a href="../MCollective/WindowsDaemon.html">MCollective::WindowsDaemon</a></li>
+
+ <li><a href="../Array.html">Array</a></li>
+
+ <li><a href="../Dir.html">Dir</a></li>
+
+ <li><a href="../Object.html">Object</a></li>
+
+ <li><a href="../String.html">String</a></li>
+
+ <li><a href="../Symbol.html">Symbol</a></li>
+
+ </ul>
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
+ </div>
+
+
+ </div>
+ </div>
+
+ <div id="documentation">
+ <h1 class="module">MCollective::DDL</h1>
+
+ <div id="description">
+ <p>
+A set of classes that helps create data description language files for
+plugins. You can define meta data, actions, input and output describing the
+behavior of your agent or other plugins
+</p>
+<p>
+<a href="DDL.html">DDL</a> files are used for input validation,
+constructing outputs, producing online help, informing the various display
+routines and so forth.
+</p>
+<p>
+A sample <a href="DDL.html">DDL</a> for an agent be seen below, you’d
+put this in your agent dir as <agent name>.ddl
+</p>
+<pre>
+ metadata :name => "SimpleRPC Service Agent",
+ :description => "Agent to manage services using the Puppet service provider",
+ :author => "R.I.Pienaar",
+ :license => "GPLv2",
+ :version => "1.1",
+ :url => "http://mcollective-plugins.googlecode.com/",
+ :timeout => 60
+
+ action "status", :description => "Gets the status of a service" do
+ display :always
+
+ input :service,
+ :prompt => "Service Name",
+ :description => "The service to get the status for",
+ :type => :string,
+ :validation => '^[a-zA-Z\-_\d]+$',
+ :optional => true,
+ :maxlength => 30
+
+ output :status,
+ :description => "The status of service",
+ :display_as => "Service Status"
+ end
+</pre>
+<p>
+There are now many types of <a href="DDL.html">DDL</a> and ultimately all
+pugins should have <a href="DDL.html">DDL</a> files. The code is organized
+so that any plugin type will magically just work - they will be an instane
+of <a href="DDL/Base.html">Base</a> which has metadata and a few common
+cases.
+</p>
+<p>
+For plugin types that require more specific behaviors they can just add a
+class here that inherits from <a href="DDL/Base.html">Base</a> and add
+their specific behavior.
+</p>
+<p>
+<a href="DDL/Base.html">Base</a> defines a specific behavior for input,
+output and metadata which we’d like to keep standard across plugin
+types so do not completely override the behavior of input. The methods are
+written that they will gladly store extra content though so you add, do not
+remove. See the <a href="DDL/AgentDDL.html">AgentDDL</a> class for an
+example where agents want a :required argument to be always set.
+</p>
+
+ </div>
+
+ <!-- Constants -->
+
+
+ <!-- Attributes -->
+
+
+ <!-- Methods -->
+
+ <div id="public-class-method-details" class="method-section section">
+ <h3 class="section-header">Public Class Methods</h3>
+
+
+ <div id="load-and-cache-method" class="method-detail ">
+ <a name="M000368"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">load_and_cache</span><span
+ class="method-args">(*args)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+
+
+ <div class="method-source-code"
+ id="load-and-cache-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 71</span>
+71: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_and_cache</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
+72: <span class="ruby-constant">Cache</span>.<span class="ruby-identifier">setup</span>(<span class="ruby-identifier">:ddl</span>, <span class="ruby-value">300</span>)
+73:
+74: <span class="ruby-identifier">plugin</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
+75: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">type</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">type</span> = <span class="ruby-value str">"agent"</span>
+76: <span class="ruby-identifier">path</span> = <span class="ruby-value str">"%s/%s"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">type</span>, <span class="ruby-identifier">plugin</span>]
+77:
+78: <span class="ruby-keyword kw">begin</span>
+79: <span class="ruby-identifier">ddl</span> = <span class="ruby-constant">Cache</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">:ddl</span>, <span class="ruby-identifier">path</span>)
+80: <span class="ruby-keyword kw">rescue</span>
+81: <span class="ruby-keyword kw">begin</span>
+82: <span class="ruby-identifier">klass</span> = <span class="ruby-constant">DDL</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-value str">"%sDDL"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">capitalize</span>)
+83: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span>
+84: <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Base</span>
+85: <span class="ruby-keyword kw">end</span>
+86:
+87: <span class="ruby-identifier">ddl</span> = <span class="ruby-constant">Cache</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">:ddl</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>))
+88: <span class="ruby-keyword kw">end</span>
+89:
+90: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ddl</span>
+91: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="new-method" class="method-detail ">
+ <a name="M000367"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">new</span><span
+ class="method-args">(*args, &blk)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+There used to be only one big nasty <a href="DDL.html">DDL</a> class with a
+bunch of mashed together behaviors. It’s been around for ages and we
+would rather not ask all the users to change their <a
+href="DDL.html#M000367">DDL.new</a> calls to some other factory method that
+would have this exact same behavior.
+</p>
+<p>
+So we override the behavior of <a href="DDL.html#M000367">new</a> which is
+a hugely sucky thing to do but ultimately it’s what would be least
+disrupting to code out there today. We did though change <a
+href="DDL.html">DDL</a> to a module to make it possibly a little less
+suprising, possibly.
+</p>
+
+
+
+ <div class="method-source-code"
+ id="new-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 67</span>
+67: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
+68: <span class="ruby-identifier">load_and_cache</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
+69: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="string-to-boolean-method" class="method-detail ">
+ <a name="M000369"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">string_to_boolean</span><span
+ class="method-args">(val)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+As we’re taking arguments on the command line we need a way to input
+booleans, true on the cli is a string so this method will take the ddl,
+find all arguments that are supposed to be boolean and if they are the
+strings “true”/“yes” or
+“false”/“no” turn them into the matching boolean
+</p>
+
+
+
+ <div class="method-source-code"
+ id="string-to-boolean-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 98</span>
+ 98: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">string_to_boolean</span>(<span class="ruby-identifier">val</span>)
+ 99: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">"true"</span>, <span class="ruby-value str">"t"</span>, <span class="ruby-value str">"yes"</span>, <span class="ruby-value str">"y"</span>, <span class="ruby-value str">"1"</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">downcase</span>)
+100: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">"false"</span>, <span class="ruby-value str">"f"</span>, <span class="ruby-value str">"no"</span>, <span class="ruby-value str">"n"</span>, <span class="ruby-value str">"0"</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">downcase</span>)
+101:
+102: <span class="ruby-identifier">raise_code</span>(<span class="ruby-identifier">:PLMC17</span>, <span class="ruby-value str">"%{value} does not look like a boolean argument"</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">val</span>)
+103: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="string-to-number-method" class="method-detail ">
+ <a name="M000370"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">string_to_number</span><span
+ class="method-args">(val)</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+a generic string to number function, if a number looks like a float it
+turns it into a float else an int. This is naive but should be sufficient
+for numbers typed on the cli in most cases
+</p>
+
+
+
+ <div class="method-source-code"
+ id="string-to-number-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 108</span>
+108: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">string_to_number</span>(<span class="ruby-identifier">val</span>)
+109: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\d+\.\d+$/</span>
+110: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\d+$/</span>
+111:
+112: <span class="ruby-identifier">raise_code</span>(<span class="ruby-identifier">:PLMC16</span>, <span class="ruby-value str">"%{value} does not look like a numeric value"</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">val</span>)
+113: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="validation-fail--method" class="method-detail ">
+ <a name="M000371"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">validation_fail!</span><span
+ class="method-args">(code, default, level, args={})</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Various <a href="DDL.html">DDL</a> implementations will validate and raise
+on error, this is a utility method to correctly setup a <a
+href="DDLValidationError.html">DDLValidationError</a> exceptions and raise
+them
+</p>
+
+
+
+ <div class="method-source-code"
+ id="validation-fail--source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 117</span>
+117: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validation_fail!</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">default</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">args</span>={})
+118: <span class="ruby-identifier">exception</span> = <span class="ruby-constant">DDLValidationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">default</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">args</span>)
+119: <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">set_backtrace</span> <span class="ruby-identifier">caller</span>
+120:
+121: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">exception</span>
+122: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
+
+ <p>Disabled; run with --debug to generate this.</p>
+
+ </div>
+
+ <div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
+ Rdoc Generator</a> 1.1.6</small>.</p>
+ </div>
+
+</body>
+</html>
+