Class: AppKernel::Function::Errors

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/appkernel/function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeErrors

Returns a new instance of Errors.

[View source]

37
38
39
40
# File 'lib/appkernel/function.rb', line 37

def initialize
  @errors = Hash.new {|h, k| h[k] = []}
  @all = []
end

Instance Attribute Details

#allObject (readonly)

Returns the value of attribute all.


33
34
35
# File 'lib/appkernel/function.rb', line 33

def all
  @all
end

Instance Method Details

#[](tag) ⇒ Object

[View source]

51
52
53
# File 'lib/appkernel/function.rb', line 51

def [](tag)
  @errors[tag]
end

#add(tag, message) ⇒ Object

[View source]

42
43
44
45
# File 'lib/appkernel/function.rb', line 42

def add(tag, message)
  @errors[tag] << message if tag
  @all << message
end

#each(&block) ⇒ Object

[View source]

47
48
49
# File 'lib/appkernel/function.rb', line 47

def each(&block)
  @all.each(&block)
end

#empty?Boolean

Returns:

[View source]

59
60
61
# File 'lib/appkernel/function.rb', line 59

def empty?
  @all.empty?
end

#lengthObject

[View source]

55
56
57
# File 'lib/appkernel/function.rb', line 55

def length
  @all.length
end