Class: Puppet::Network::FormatHandler::FormatProtector
- Defined in:
- lib/vendor/puppet/network/format_handler.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
Instance Method Summary collapse
-
#initialize(format) ⇒ FormatProtector
constructor
A new instance of FormatProtector.
- #protect(method, args) ⇒ Object
Constructor Details
#initialize(format) ⇒ FormatProtector
Returns a new instance of FormatProtector.
20 21 22 |
# File 'lib/vendor/puppet/network/format_handler.rb', line 20 def initialize(format) @format = format end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
9 10 11 |
# File 'lib/vendor/puppet/network/format_handler.rb', line 9 def format @format end |
Instance Method Details
#protect(method, args) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/vendor/puppet/network/format_handler.rb', line 11 def protect(method, args) Puppet::Network::FormatHandler.format(format).send(method, *args) rescue => details direction = method.to_s.include?("intern") ? "from" : "to" error = FormatError.new("Could not #{method} #{direction} #{format}: #{details}") error.set_backtrace(details.backtrace) raise error end |