Class: Puppet::Parameter::Value
- Defined in:
- lib/vendor/puppet/parameter/value.rb
Overview
An individual Value class.
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#call ⇒ Object
Returns the value of attribute call.
-
#event ⇒ Object
Returns the value of attribute event.
-
#method ⇒ Object
Returns the value of attribute method.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#required_features ⇒ Object
Returns the value of attribute required_features.
Instance Method Summary collapse
-
#alias(name) ⇒ Object
Add an alias for this value.
-
#aliases ⇒ Object
Return all aliases.
-
#initialize(name) ⇒ Value
constructor
A new instance of Value.
-
#match?(value) ⇒ Boolean
Does a provided value match our value?.
-
#regex? ⇒ Boolean
Is our value a regex?.
Constructor Details
#initialize(name) ⇒ Value
Returns a new instance of Value.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vendor/puppet/parameter/value.rb', line 23 def initialize(name) if name.is_a?(Regexp) @name = name else # Convert to a string and then a symbol, so things like true/false # still show up as symbols. @name = convert(name) end @aliases = [] @call = :instead end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
6 7 8 |
# File 'lib/vendor/puppet/parameter/value.rb', line 6 def block @block end |
#call ⇒ Object
Returns the value of attribute call.
6 7 8 |
# File 'lib/vendor/puppet/parameter/value.rb', line 6 def call @call end |
#event ⇒ Object
Returns the value of attribute event.
5 6 7 |
# File 'lib/vendor/puppet/parameter/value.rb', line 5 def event @event end |
#method ⇒ Object
Returns the value of attribute method.
6 7 8 |
# File 'lib/vendor/puppet/parameter/value.rb', line 6 def method @method end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/vendor/puppet/parameter/value.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/vendor/puppet/parameter/value.rb', line 5 def @options end |
#required_features ⇒ Object
Returns the value of attribute required_features.
6 7 8 |
# File 'lib/vendor/puppet/parameter/value.rb', line 6 def required_features @required_features end |
Instance Method Details
#alias(name) ⇒ Object
Add an alias for this value.
9 10 11 |
# File 'lib/vendor/puppet/parameter/value.rb', line 9 def alias(name) @aliases << convert(name) end |
#aliases ⇒ Object
Return all aliases.
14 15 16 |
# File 'lib/vendor/puppet/parameter/value.rb', line 14 def aliases @aliases.dup end |
#match?(value) ⇒ Boolean
Does a provided value match our value?
38 39 40 41 42 43 44 |
# File 'lib/vendor/puppet/parameter/value.rb', line 38 def match?(value) if regex? return true if name =~ value.to_s else return(name == convert(value) ? true : @aliases.include?(convert(value))) end end |
#regex? ⇒ Boolean
Is our value a regex?
47 48 49 |
# File 'lib/vendor/puppet/parameter/value.rb', line 47 def regex? @name.is_a?(Regexp) end |