Class: Gratan::DSL::Context::On
- Inherits:
-
Object
- Object
- Gratan::DSL::Context::On
- Includes:
- Validator
- Defined in:
- lib/gratan/dsl/context/on.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #grant(name, options = {}) ⇒ Object
-
#initialize(user, host, object, &block) ⇒ On
constructor
A new instance of On.
Methods included from Validator
Constructor Details
#initialize(user, host, object, &block) ⇒ On
Returns a new instance of On.
6 7 8 9 10 |
# File 'lib/gratan/dsl/context/on.rb', line 6 def initialize(user, host, object, &block) @error_identifier = "User `#{user}@#{host}` on `#{object}`" @result = [] instance_eval(&block) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/gratan/dsl/context/on.rb', line 4 def result @result end |
Instance Method Details
#grant(name, options = {}) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/gratan/dsl/context/on.rb', line 12 def grant(name, = {}) __validate("Grant `#{name}` is already defined") do not @result.include?(name) end @result << name end |