Class: Sequel::Plugins::NotNaughty
- Inherits:
-
NotNaughty::Validator
- Object
- NotNaughty::Validator
- Sequel::Plugins::NotNaughty
- Defined in:
- lib/sequel_notnaughty.rb
Overview
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
-
.apply(receiver, *args) ⇒ Object
Hook called by plugin api.
Instance Method Summary collapse
-
#get_state(instance) ⇒ Object
Returns state for given instance.
Class Method Details
.apply(receiver, *args) ⇒ Object
Hook called by plugin api.
30 31 32 33 |
# File 'lib/sequel_notnaughty.rb', line 30 def self.apply(receiver, *args) receiver.extend ::NotNaughty receiver.validator self, :create, :update end |
Instance Method Details
#get_state(instance) ⇒ Object
Returns state for given instance.
36 37 38 |
# File 'lib/sequel_notnaughty.rb', line 36 def get_state(instance) if instance.new? then @states[:create] else @states[:update] end end |