lib/ssh_scan/policy.rb in ssh_scan-0.0.20 vs lib/ssh_scan/policy.rb in ssh_scan-0.0.21

- old
+ new

@@ -1,8 +1,10 @@ require 'yaml' module SSHScan + # Policy methods that deal with key exchange, macs, encryption methods, + # compression methods and more. class Policy attr_reader :name, :kex, :macs, :encryption, :compression, :references, :auth_methods, :ssh_version def initialize(opts = {}) @@ -14,14 +16,22 @@ @references = opts['references'] || [] @auth_methods = opts['auth_methods'] || [] @ssh_version = opts['ssh_version'] || false end + # Generate a {SSHScan::Policy} object from YAML file. + # @param file [String] filepath + # @return [SSHScan::Policy] new instance with parameters loaded + # from YAML file def self.from_file(file) opts = YAML.load_file(file) self.new(opts) end + # Generate a {SSHScan::Policy} object from YAML string. + # @param string [String] YAML string + # @return [SSHScan::Policy] new instance with parameters loaded + # from given string def self.from_string(string) opts = YAML.load(string) self.new(opts) end end