Sha256: e3596a51458903210428525e4049aa7fe83302a32a2544a0d4bf9423d1b862b2

Contents?: true

Size: 868 Bytes

Versions: 11

Compression:

Stored size: 868 Bytes

Contents

class Posgra::DSL::Grants::Role::Schema
  include Posgra::Logger::Helper
  include Posgra::TemplateHelper
  include Posgra::Utils::Helper

  attr_reader :result

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

  def on(name, options = {}, &block)
    unless name.is_a?(Regexp)
      name = name.to_s
      return unless matched?(name, @options[:include_object], @options[:exclude_object])
    end

    if options[:expired]
      expired = Time.parse(options[: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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
posgra-0.2.3.beta lib/posgra/dsl/grants/role/schema.rb
posgra-0.2.2 lib/posgra/dsl/grants/role/schema.rb
posgra-0.2.1 lib/posgra/dsl/grants/role/schema.rb
posgra-0.2.0 lib/posgra/dsl/grants/role/schema.rb
posgra-0.1.9 lib/posgra/dsl/grants/role/schema.rb
posgra-0.1.8 lib/posgra/dsl/grants/role/schema.rb
posgra-0.1.7 lib/posgra/dsl/grants/role/schema.rb
posgra-0.1.6 lib/posgra/dsl/grants/role/schema.rb
posgra-0.1.5 lib/posgra/dsl/grants/role/schema.rb
posgra-0.1.4 lib/posgra/dsl/grants/role/schema.rb
posgra-0.1.3 lib/posgra/dsl/grants/role/schema.rb