Module: Railjet::Policy

Extended by:
ActiveSupport::Concern
Includes:
Validator
Defined in:
lib/railjet/policy.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/railjet/policy.rb', line 6

def context
  @context
end

#objectObject (readonly)

Returns the value of attribute object.



6
7
8
# File 'lib/railjet/policy.rb', line 6

def object
  @object
end

Instance Method Details

#initialize(context, object) ⇒ Object



8
9
10
# File 'lib/railjet/policy.rb', line 8

def initialize(context, object)
  @context, @object = context, object
end

#validate!Object



12
13
14
# File 'lib/railjet/policy.rb', line 12

def validate!
  valid? || (raise Railjet::PolicyError.new(errors) )
end