Class: Posgra::DSL::Grants::Role::Schema
- Inherits:
-
Object
- Object
- Posgra::DSL::Grants::Role::Schema
- Includes:
- Logger::Helper, TemplateHelper, Utils::Helper
- Defined in:
- lib/posgra/dsl/grants/role/schema.rb
Defined Under Namespace
Classes: On
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(context, schema, options, &block) ⇒ Schema
constructor
A new instance of Schema.
- #on(name, options = {}, &block) ⇒ Object
Methods included from Utils::Helper
Methods included from TemplateHelper
Methods included from Logger::Helper
Constructor Details
#initialize(context, schema, options, &block) ⇒ Schema
Returns a new instance of Schema.
8 9 10 11 12 13 14 |
# File 'lib/posgra/dsl/grants/role/schema.rb', line 8 def initialize(context, schema, , &block) @schema = schema @options = @context = context.merge(:schema => schema) @result = {} instance_eval(&block) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/posgra/dsl/grants/role/schema.rb', line 6 def result @result end |
Instance Method Details
#on(name, options = {}, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/posgra/dsl/grants/role/schema.rb', line 16 def on(name, = {}, &block) unless name.is_a?(Regexp) name = name.to_s return unless matched?(name, @options[:include_object], @options[:exclude_object]) end if [:expired] expired = Time.parse([:expired]) if Time.new >= expired log(:warn, "Privilege for `#{name}` has expired", :color => :yellow) return end end @result[name] = Posgra::DSL::Grants::Role::Schema::On.new(@context, name, @options, &block).result end |