Class: Kangaru::Validation::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/kangaru/validation/error.rb

Constant Summary collapse

MESSAGES =
{
  blank: "can't be blank"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute:, type:) ⇒ Error

Returns a new instance of Error.



12
13
14
15
# File 'lib/kangaru/validation/error.rb', line 12

def initialize(attribute:, type:)
  @attribute = attribute
  @type = type
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



10
11
12
# File 'lib/kangaru/validation/error.rb', line 10

def attribute
  @attribute
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/kangaru/validation/error.rb', line 10

def type
  @type
end

Instance Method Details

#full_messageObject



17
18
19
# File 'lib/kangaru/validation/error.rb', line 17

def full_message
  [human_attribute, message].join(" ")
end