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