Module: Protector::DSL::Entry::ClassMethods

Defined in:
lib/protector/dsl.rb

Instance Method Summary collapse

Instance Method Details

#ensure_protector_meta!(adapter, &column_names) ⇒ Object



331
332
333
334
335
336
337
# File 'lib/protector/dsl.rb', line 331

def ensure_protector_meta!(adapter, &column_names)
  @protector_meta ||= if superclass && superclass.respond_to?(:protector_meta)
    superclass.protector_meta.inherit(self, &column_names)
  else
    Protector::DSL::Meta.new(adapter, self, &column_names)
  end
end

#protect {|subject, instance| ... } ⇒ Object

Registers protection DSL block

Yields:

  • (subject, instance)

    Evaluates conditions described in terms of Meta::Box.

Yield Parameters:

  • subject (Object)

    Subject that object was restricted with

  • instance (Object)

    Reference to the object being restricted (can be nil)



327
328
329
# File 'lib/protector/dsl.rb', line 327

def protect(&block)
  protector_meta << block
end