Class: RCS::Common::WinFirewall::AdvfirewallResponse

Inherits:
String
  • Object
show all
Defined in:
lib/rcs-common/winfirewall.rb

Overview

Parse the response of the netsh advfirewall command

Constant Summary collapse

SEPARATOR =
'-'*70

Constants inherited from String

String::REMOVE_INVALID_CHARS_REGEXP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#binary_add_at_offset, #binary_patch, #binary_patch_at_offset, #force_utf8, #force_utf8!, #keywords, #pascalize, #remove_invalid_chars, #safe_utf8_encode, #safe_utf8_encode_invalid, #strip_html_tags, #terminate_utf16le, #to_binary, #to_utf16le, #to_utf16le_binary, #to_utf16le_binary_null, #unpascalize, #unpascalize_ary, #utf16le_to_utf8

Instance Attribute Details

#okObject

Returns the value of attribute ok.



128
129
130
# File 'lib/rcs-common/winfirewall.rb', line 128

def ok
  @ok
end

Instance Method Details

#first_lineObject



139
140
141
142
143
# File 'lib/rcs-common/winfirewall.rb', line 139

def first_line
  index = nil
  self.lines.each_with_index{ |line, i| index = i if line.include?(SEPARATOR)  }
  self.lines[index+1].strip if index
end

#has_separator?Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/rcs-common/winfirewall.rb', line 135

def has_separator?
  self.include?(SEPARATOR)
end

#ok?Boolean

Returns:

  • (Boolean)


130
131
132
133
# File 'lib/rcs-common/winfirewall.rb', line 130

def ok?
  return self.ok unless self.ok.nil?
  self.strip =~ /OK\.\z/i
end