Class: Audiothority::Violation

Inherits:
Validation show all
Defined in:
lib/audiothority/validation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Validation

#invalid?, #valid?

Constructor Details

#initialize(field, reason, message, applicable = true) ⇒ Violation

Returns a new instance of Violation.



21
22
23
24
25
26
27
# File 'lib/audiothority/validation.rb', line 21

def initialize(field, reason, message, applicable=true)
  super(false)
  @field = field
  @reason = reason
  @message = message
  @applicable = applicable
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



19
20
21
# File 'lib/audiothority/validation.rb', line 19

def field
  @field
end

#messageObject (readonly)

Returns the value of attribute message.



19
20
21
# File 'lib/audiothority/validation.rb', line 19

def message
  @message
end

#reasonObject (readonly)

Returns the value of attribute reason.



19
20
21
# File 'lib/audiothority/validation.rb', line 19

def reason
  @reason
end

Instance Method Details

#applicable?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/audiothority/validation.rb', line 29

def applicable?
  !!@applicable
end