Class: Valcro::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(property, message) ⇒ Error

Returns a new instance of Error.



7
8
9
10
# File 'lib/valcro/error.rb', line 7

def initialize(property, message)
  @property = property
  @message = message
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/valcro/error.rb', line 5

def message
  @message
end

#propertyObject

Returns the value of attribute property.



5
6
7
# File 'lib/valcro/error.rb', line 5

def property
  @property
end

Instance Method Details

#to_sObject



12
13
14
15
16
17
18
# File 'lib/valcro/error.rb', line 12

def to_s
  if @property == :base
    message
  else
    "#{property} #{message}"
  end
end