Class: Posgra::DSL::Grants::Role::Schema
- Inherits:
-
Object
- Object
- Posgra::DSL::Grants::Role::Schema
- Includes:
- Logger::Helper, TemplateHelper
- 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 TemplateHelper
Methods included from Logger::Helper
Constructor Details
#initialize(context, schema, options, &block) ⇒ Schema
Returns a new instance of Schema.
7 8 9 10 11 12 13 |
# File 'lib/posgra/dsl/grants/role/schema.rb', line 7 def initialize(context, schema, , &block) @schema = schema = @context = context.merge(:schema => schema) @result = {} instance_eval(&block) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
5 6 7 |
# File 'lib/posgra/dsl/grants/role/schema.rb', line 5 def result @result end |
Instance Method Details
#on(name, options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/posgra/dsl/grants/role/schema.rb', line 15 def on(name, = {}, &block) unless name.is_a?(Regexp) name = name.to_s 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, , &block).result end |