Class: Tram::Policy::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/tram/policy/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



4
5
6
# File 'lib/tram/policy/validator.rb', line 4

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/tram/policy/validator.rb', line 4

def name
  @name
end

#stop_on_failureObject (readonly)

Returns the value of attribute stop_on_failure.



4
5
6
# File 'lib/tram/policy/validator.rb', line 4

def stop_on_failure
  @stop_on_failure
end

Instance Method Details

#==(other) ⇒ Object



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

def ==(other)
  other.is_a?(self.class) && name && other.name == name
end

#check(object) ⇒ Object



10
11
12
# File 'lib/tram/policy/validator.rb', line 10

def check(object)
  name ? object.__send__(name) : object.instance_exec(&block)
end