Class: SimpleRecord::SimpleRecord_errors

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_record/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(*params) ⇒ SimpleRecord_errors

Returns a new instance of SimpleRecord_errors.



18
19
20
21
# File 'lib/simple_record/errors.rb', line 18

def initialize(*params)
    super(*params)
    @errors=[]
end

Instance Method Details

#add(attribute, value) ⇒ Object



27
28
29
# File 'lib/simple_record/errors.rb', line 27

def add(attribute, value)
    @errors+=["#{attribute.to_s} #{value}"]
end

#add_to_base(value) ⇒ Object



23
24
25
# File 'lib/simple_record/errors.rb', line 23

def add_to_base(value)
    @errors+=[value]
end

#clearObject



47
48
49
# File 'lib/simple_record/errors.rb', line 47

def clear
    @errors.clear
end

#countObject



31
32
33
# File 'lib/simple_record/errors.rb', line 31

def count
    return length
end

#empty?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/simple_record/errors.rb', line 51

def empty?
    @errors.empty?
end

#full_messagesObject



43
44
45
# File 'lib/simple_record/errors.rb', line 43

def full_messages
    return @errors
end

#lengthObject



35
36
37
# File 'lib/simple_record/errors.rb', line 35

def length
    return @errors.length
end

#sizeObject



39
40
41
# File 'lib/simple_record/errors.rb', line 39

def size
    return length
end