Class: Posgra::DSL::Grants::Role::Schema::On

Inherits:
Object
  • Object
show all
Includes:
Logger::Helper, TemplateHelper
Defined in:
lib/posgra/dsl/grants/role/schema/on.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Methods included from Logger::Helper

#log

Constructor Details

#initialize(context, object, options, &block) ⇒ On

Returns a new instance of On.



7
8
9
10
11
12
13
# File 'lib/posgra/dsl/grants/role/schema/on.rb', line 7

def initialize(context, object, options, &block)
  @object = object
  @options = options
  @context = context.merge(:object => object)
  @result = {}
  instance_eval(&block)
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



5
6
7
# File 'lib/posgra/dsl/grants/role/schema/on.rb', line 5

def result
  @result
end

Instance Method Details

#grant(name, options = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/posgra/dsl/grants/role/schema/on.rb', line 15

def grant(name, options = {})
  name = name.to_s

  @result[name] = {
    'is_grantable' => !!options[:grantable]
  }
end