Class: SSH::Allow::RuleSet
- Inherits:
-
Object
- Object
- SSH::Allow::RuleSet
- Defined in:
- lib/ssh/allow/rule_set.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #allow(cmd, &block) ⇒ Object
- #allow!(cmd, &block) ⇒ Object
-
#initialize ⇒ RuleSet
constructor
A new instance of RuleSet.
- #read(path_to_rules) ⇒ Object
Constructor Details
#initialize ⇒ RuleSet
Returns a new instance of RuleSet.
6 7 8 |
# File 'lib/ssh/allow/rule_set.rb', line 6 def initialize @rules = [] end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
4 5 6 |
# File 'lib/ssh/allow/rule_set.rb', line 4 def rules @rules end |
Instance Method Details
#allow(cmd, &block) ⇒ Object
10 11 12 |
# File 'lib/ssh/allow/rule_set.rb', line 10 def allow(cmd, &block) push get_rule(:allow, cmd, block) end |
#allow!(cmd, &block) ⇒ Object
14 15 16 17 |
# File 'lib/ssh/allow/rule_set.rb', line 14 def allow!(cmd, &block) rule = get_rule(:allow, cmd, block) push(rule) or raise(%(Invalid rule: "#{cmd}")) end |
#read(path_to_rules) ⇒ Object
19 20 21 |
# File 'lib/ssh/allow/rule_set.rb', line 19 def read(path_to_rules) self.instance_eval(read_rules(path_to_rules)) end |