Method: Rbeapi::Api::Entity#get_block
- Defined in:
- lib/rbeapi/api.rb
#get_block(text) ⇒ nil, String
Returns a block of configuration from the current running config as a string. The argument is used to search the config and return the text along with any child configuration statements.
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rbeapi/api.rb', line 103 def get_block(text) mdata = /^#{text}$/.match(config) return nil unless mdata block_start, line_end = mdata.offset(0) mdata = /^[^\s]/.match(config, line_end) return nil unless mdata _, block_end = mdata.offset(0) block_end -= block_start config[block_start, block_end] end |